From: Shilong Jiao <[email protected]> The test_lazy function requires html.parser to not be in sys.modules, but if test_move_items runs first (which happens in pytest's execution order), it imports the module causing test_lazy to fail.
Add fix-test-lazy-order.patch to clean up module state before testing to avoid test order dependency. Signed-off-by: Shilong Jiao <[email protected]> --- .../python3-six/fix-test-lazy-order.patch | 23 +++++++++++++++++++ .../python/python3-six_1.17.0.bb | 5 +++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/python/python3-six/fix-test-lazy-order.patch diff --git a/meta/recipes-devtools/python/python3-six/fix-test-lazy-order.patch b/meta/recipes-devtools/python/python3-six/fix-test-lazy-order.patch new file mode 100644 index 0000000000..9c22872e1f --- /dev/null +++ b/meta/recipes-devtools/python/python3-six/fix-test-lazy-order.patch @@ -0,0 +1,23 @@ +Ensure test_lazy runs with clean module state + +The test_lazy function requires html.parser to not be in sys.modules, +but if test_move_items runs first, it imports the module causing +test_lazy to fail. Clean up the module state before testing. + +Upstream-Status: Pending +Signed-off-by: Shilong Jiao <[email protected]> + +--- a/test_six.py ++++ b/test_six.py +@@ -89,6 +89,9 @@ def test_maxsize(): + + def test_lazy(): + if six.PY3: + html_name = "html.parser" + else: + html_name = "HTMLParser" ++ # Ensure clean state for lazy import test ++ sys.modules.pop(html_name, None) ++ six._MovedItems.__dict__.pop("html_parser", None) + assert html_name not in sys.modules + mod = six.moves.html_parser diff --git a/meta/recipes-devtools/python/python3-six_1.17.0.bb b/meta/recipes-devtools/python/python3-six_1.17.0.bb index 213b3dc593..2a12831bea 100644 --- a/meta/recipes-devtools/python/python3-six_1.17.0.bb +++ b/meta/recipes-devtools/python/python3-six_1.17.0.bb @@ -3,7 +3,10 @@ require python-six.inc SRC_URI[sha256sum] = "ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81" -SRC_URI += "file://run-ptest" +SRC_URI += " \ + file://run-ptest \ + file://fix-test-lazy-order.patch \ +" RDEPENDS:${PN}-ptest += " \ bash \ -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#238425): https://lists.openembedded.org/g/openembedded-core/message/238425 Mute This Topic: https://lists.openembedded.org/mt/119753080/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
