Skip to content

Commit 51eb009

Browse files
[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 4269509) Co-authored-by: Victor Stinner <[email protected]>
1 parent a064233 commit 51eb009

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
@@ -238,7 +238,8 @@ def target():
238238
self.addCleanup(forget, TESTFN)
239239
self.addCleanup(rmtree, '__pycache__')
240240
importlib.invalidate_caches()
241-
__import__(TESTFN)
241+
with threading_helper.wait_threads_exit():
242+
__import__(TESTFN)
242243
del sys.modules[TESTFN]
243244

244245
def test_concurrent_futures_circular_import(self):

0 commit comments

Comments
 (0)