summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-05-24 08:29:35 (GMT)
committerGitHub <noreply@github.com>2023-05-24 08:29:35 (GMT)
commit426950993f6a39cdf3f6a3333ac8b518833c7e61 (patch)
tree3bd32c200b8c71c6efffc3dc04190e8b7b1a8f04
parentc0ab7d401c736c37bf4462eef7c7d69fef8fab93 (diff)
downloadcpython-426950993f6a39cdf3f6a3333ac8b518833c7e61.zip
cpython-426950993f6a39cdf3f6a3333ac8b518833c7e61.tar.gz
cpython-426950993f6a39cdf3f6a3333ac8b518833c7e61.tar.bz2
Fix test_importlib.test_side_effect_import() (#104840)
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
-rw-r--r--Lib/test/test_importlib/test_threaded_import.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/test_threaded_import.py b/Lib/test/test_importlib/test_threaded_import.py
index 85c3032..68de4a6 100644
--- a/Lib/test/test_importlib/test_threaded_import.py
+++ b/Lib/test/test_importlib/test_threaded_import.py
@@ -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):