]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix test_importlib.test_side_effect_import() (#104840)
authorVictor Stinner <vstinner@python.org>
Wed, 24 May 2023 08:29:35 +0000 (10:29 +0200)
committerGitHub <noreply@github.com>
Wed, 24 May 2023 08:29:35 +0000 (10:29 +0200)
Wait until the thread spawn by the import completes to avoid dangling
threads. With this fix, the following command no longer fails:

./python -m test --fail-env-changed test_importlib -m test_side_effect_import -F -j20

Lib/test/test_importlib/test_threaded_import.py

index 85c3032aed53b182a75abd494797ef9ba9788c65..68de4a66f3c703f1ad2f49d9080f04d687aa09f0 100644 (file)
@@ -238,7 +238,8 @@ class ThreadedImportTests(unittest.TestCase):
         self.addCleanup(forget, TESTFN)
         self.addCleanup(rmtree, '__pycache__')
         importlib.invalidate_caches()
-        __import__(TESTFN)
+        with threading_helper.wait_threads_exit():
+            __import__(TESTFN)
         del sys.modules[TESTFN]
 
     def test_concurrent_futures_circular_import(self):