Skip to content

Commit 76873ca

Browse files
[3.11] Fix test_importlib.test_side_effect_import() (GH-104840) (#104843)
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 4269509) Co-authored-by: Victor Stinner <[email protected]>
1 parent 3b3f2e1 commit 76873ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Lib/test/test_importlib/test_threaded_import.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ def target():
244244
self.addCleanup(forget, TESTFN)
245245
self.addCleanup(rmtree, '__pycache__')
246246
importlib.invalidate_caches()
247-
__import__(TESTFN)
247+
with threading_helper.wait_threads_exit():
248+
__import__(TESTFN)
248249
del sys.modules[TESTFN]
249250

250251
def test_concurrent_futures_circular_import(self):

0 commit comments

Comments
 (0)