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:42:05 +0000
commit10cde1b2ad1da907301245696520eab8b86e204f (patch)
tree559ba3a7542abf5278ed00bd63ab2ddbbee076e4 /meta
parentbd446d8207e7d33d5628bf6a03bd729121207dd0 (diff)
downloadpoky-10cde1b2ad1da907301245696520eab8b86e204f.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. (From OE-Core rev: 595086756c6f24762e08cde9f9ed3e1056976d98) 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 @@
1From 04a864f33848da6af1dea906ba4922770022ef66 Mon Sep 17 00:00:00 2001
2From: Ross Burton <ross.burton@arm.com>
3Date: Thu, 16 Mar 2023 14:21:32 +0000
4Subject: [PATCH] Clean up test runner
5
6Test code doesn't need to manually construct a TestSuite and a
7TextTestRunner, the unittest module has a discovery function that does
8all this for you.
9
10Delete all of the manual logic from tests.py, replace it with the two
11lines to bring in the doctest unit tests, and update the makefile to
12run the unittest discovery.
13
14Upstream-Status: Submitted [https://github.com/stefankoegl/python-json-pointer/pull/54]
15Signed-off-by: Ross Burton <ross.burton@arm.com>
16---
17 makefile | 2 +-
18 tests.py | 24 ++++--------------------
19 2 files changed, 5 insertions(+), 21 deletions(-)
20
21diff --git a/tests.py b/tests.py
22index 9252369..6b4b8cc 100755
23--- a/tests.py
24+++ b/tests.py
25@@ -7,6 +7,7 @@ import doctest
26 import unittest
27 import sys
28 import copy
29+import jsonpointer
30 from jsonpointer import resolve_pointer, EndOfList, JsonPointerException, \
31 JsonPointer, set_pointer
32
33@@ -410,23 +411,6 @@ class AltTypesTests(unittest.TestCase):
34 self.assertRaises(JsonPointerException, resolve_pointer, doc, '/root/1/2/3/4')
35
36
37-
38-suite = unittest.TestSuite()
39-suite.addTest(unittest.makeSuite(SpecificationTests))
40-suite.addTest(unittest.makeSuite(ComparisonTests))
41-suite.addTest(unittest.makeSuite(WrongInputTests))
42-suite.addTest(unittest.makeSuite(ToLastTests))
43-suite.addTest(unittest.makeSuite(SetTests))
44-suite.addTest(unittest.makeSuite(AltTypesTests))
45-
46-modules = ['jsonpointer']
47-
48-for module in modules:
49- m = __import__(module, fromlist=[module])
50- suite.addTest(doctest.DocTestSuite(m))
51-
52-runner = unittest.TextTestRunner(verbosity=1)
53-result = runner.run(suite)
54-
55-if not result.wasSuccessful():
56- sys.exit(1)
57+def load_tests(loader, tests, ignore):
58+ tests.addTests(doctest.DocTestSuite(jsonpointer))
59+ return tests
60--
612.34.1
62
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 @@
1#!/bin/sh 1#!/bin/sh
2 2
3python3 tests.py 3python3 -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"
5 5
6inherit pypi ptest setuptools3 6inherit pypi ptest setuptools3
7 7
8SRC_URI += "file://0001-Clean-up-test-runner.patch"
9
8SRC_URI[sha256sum] = "97cba51526c829282218feb99dab1b1e6bdf8efd1c43dc9d57be093c0d69c99a" 10SRC_URI[sha256sum] = "97cba51526c829282218feb99dab1b1e6bdf8efd1c43dc9d57be093c0d69c99a"
9 11
10RDEPENDS:${PN} += " \ 12RDEPENDS:${PN} += " \
@@ -18,7 +20,9 @@ SRC_URI += " \
18" 20"
19 21
20RDEPENDS:${PN}-ptest += " \ 22RDEPENDS:${PN}-ptest += " \
21 ${PYTHON_PN}-pytest \ 23 ${PYTHON_PN}-doctest \
24 ${PYTHON_PN}-unittest \
25 ${PYTHON_PN}-unittest-automake-output \
22" 26"
23 27
24do_install_ptest() { 28do_install_ptest() {