summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_threaded_import.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-05-25 00:36:13 (GMT)
committerGitHub <noreply@github.com>2023-05-25 00:36:13 (GMT)
commit51eb009cef155f02c59d05ce1f0d93c50ea9085a (patch)
tree8035dfa846aef174b2923d645e9d7e0bcfb6b27b /Lib/test/test_importlib/test_threaded_import.py
parenta06423388618424e2c6dab2ab503fdca5a953e38 (diff)
downloadcpython-51eb009cef155f02c59d05ce1f0d93c50ea9085a.zip
cpython-51eb009cef155f02c59d05ce1f0d93c50ea9085a.tar.gz
cpython-51eb009cef155f02c59d05ce1f0d93c50ea9085a.tar.bz2
[3.12] Fix test_importlib.test_side_effect_import() (GH-104840) (#104842)
Fix test_importlib.test_side_effect_import() (GH-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 (cherry picked from commit 426950993f6a39cdf3f6a3333ac8b518833c7e61) Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib/test/test_importlib/test_threaded_import.py')
-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):