summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@arm.com>2023-03-21 12:37:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-03-21 22:40:46 +0000
commit595086756c6f24762e08cde9f9ed3e1056976d98 (patch)
treeb490f6011701db1c98977e9cab14acf35285bd30 /meta
parent88b320cfb38b69b2d9035d2300359ff3d0dbd598 (diff)
downloadopenembedded-core-595086756c6f24762e08cde9f9ed3e1056976d98.tar.gz
python3-jsonpointer: rewrite testing
The tests installed by jsonpointer use unittest not pytest, so update the dependencies. Use the unittest runner in python3-unittest-automake-output to get the correct output. Apply a patch so the test suite doesn't run twice. Signed-off-by: Ross Burton <ross.burton@arm.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/python/python3-jsonpointer/0001-Clean-up-test-runner.patch62
-rw-r--r--meta/recipes-devtools/python/python3-jsonpointer/run-ptest2
-rw-r--r--meta/recipes-devtools/python/python3-jsonpointer_2.3.bb6
3 files changed, 68 insertions, 2 deletions
diff --git a/meta/recipes-devtools/python/python3-jsonpointer/0001-Clean-up-test-runner.patch b/meta/recipes-devtools/python/python3-jsonpointer/0001-Clean-up-test-runner.patch
new file mode 100644
index 0000000000..4121834dbf
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-jsonpointer/0001-Clean-up-test-runner.patch
@@ -0,0 +1,62 @@
+From 04a864f33848da6af1dea906ba4922770022ef66 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Thu, 16 Mar 2023 14:21:32 +0000
+Subject: [PATCH] Clean up test runner
+
+Test code doesn't need to manually construct a TestSuite and a
+TextTestRunner, the unittest module has a discovery function that does
+all this for you.
+
+Delete all of the manual logic from tests.py, replace it with the two
+lines to bring in the doctest unit tests, and update the makefile to
+run the unittest discovery.
+
+Upstream-Status: Submitted [https://github.com/stefankoegl/python-json-pointer/pull/54]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ makefile | 2 +-
+ tests.py | 24 ++++--------------------
+ 2 files changed, 5 insertions(+), 21 deletions(-)
+
+diff --git a/tests.py b/tests.py
+index 9252369..6b4b8cc 100755
+--- a/tests.py
++++ b/tests.py
+@@ -7,6 +7,7 @@ import doctest
+ import unittest
+ import sys
+ import copy
++import jsonpointer
+ from jsonpointer import resolve_pointer, EndOfList, JsonPointerException, \
+ JsonPointer, set_pointer
+
+@@ -410,23 +411,6 @@ class AltTypesTests(unittest.TestCase):
+ self.assertRaises(JsonPointerException, resolve_pointer, doc, '/root/1/2/3/4')
+
+
+-
+-suite = unittest.TestSuite()
+-suite.addTest(unittest.makeSuite(SpecificationTests))
+-suite.addTest(unittest.makeSuite(ComparisonTests))
+-suite.addTest(unittest.makeSuite(WrongInputTests))
+-suite.addTest(unittest.makeSuite(ToLastTests))
+-suite.addTest(unittest.makeSuite(SetTests))
+-suite.addTest(unittest.makeSuite(AltTypesTests))
+-
+-modules = ['jsonpointer']
+-
+-for module in modules:
+- m = __import__(module, fromlist=[module])
+- suite.addTest(doctest.DocTestSuite(m))
+-
+-runner = unittest.TextTestRunner(verbosity=1)
+-result = runner.run(suite)
+-
+-if not result.wasSuccessful():
+- sys.exit(1)
++def load_tests(loader, tests, ignore):
++ tests.addTests(doctest.DocTestSuite(jsonpointer))
++ return tests
+--
+2.34.1
+
diff --git a/meta/recipes-devtools/python/python3-jsonpointer/run-ptest b/meta/recipes-devtools/python/python3-jsonpointer/run-ptest
index 51e609f4ba..7ebd69231f 100644
--- a/meta/recipes-devtools/python/python3-jsonpointer/run-ptest
+++ b/meta/recipes-devtools/python/python3-jsonpointer/run-ptest
@@ -1,3 +1,3 @@
#!/bin/sh
-python3 tests.py
+python3 -mputao.unittest tests.py
diff --git a/meta/recipes-devtools/python/python3-jsonpointer_2.3.bb b/meta/recipes-devtools/python/python3-jsonpointer_2.3.bb
index 16d5cab4cf..0ec4de055c 100644
--- a/meta/recipes-devtools/python/python3-jsonpointer_2.3.bb
+++ b/meta/recipes-devtools/python/python3-jsonpointer_2.3.bb
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=32b15c843b7a329130f4e266a281ebb3"
inherit pypi ptest setuptools3
+SRC_URI += "file://0001-Clean-up-test-runner.patch"
+
SRC_URI[sha256sum] = "97cba51526c829282218feb99dab1b1e6bdf8efd1c43dc9d57be093c0d69c99a"
RDEPENDS:${PN} += " \
@@ -18,7 +20,9 @@ SRC_URI += " \
"
RDEPENDS:${PN}-ptest += " \
- ${PYTHON_PN}-pytest \
+ ${PYTHON_PN}-doctest \
+ ${PYTHON_PN}-unittest \
+ ${PYTHON_PN}-unittest-automake-output \
"
do_install_ptest() {