Skip to content

Commit

Permalink
Fix test_importlib.test_side_effect_import() (pythonGH-104840)
Browse files Browse the repository at this point in the history
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 <vstinner@python.org>
  • Loading branch information
vstinner authored and miss-islington committed May 24, 2023
1 parent b719dd8 commit 85e9c2f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Lib/test/test_importlib/test_threaded_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ def target():
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):
Expand Down

0 comments on commit 85e9c2f

Please sign in to comment.