Skip to content

Commit

Permalink
bpo-31234: test_threaded_import: fix test_side_effect_import() (pytho…
Browse files Browse the repository at this point in the history
…n#3189)

* Don't leak the module into sys.modules
* Avoid dangling thread
  • Loading branch information
vstinner authored Aug 22, 2017
1 parent 830d7d2 commit 41bbd82
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Lib/test/test_threaded_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ def target():
import random
t = threading.Thread(target=target)
t.start()
t.join()"""
t.join()
t = None"""
sys.path.insert(0, os.curdir)
self.addCleanup(sys.path.remove, os.curdir)
filename = TESTFN + ".py"
Expand All @@ -241,6 +242,7 @@ def target():
self.addCleanup(rmtree, '__pycache__')
importlib.invalidate_caches()
__import__(TESTFN)
del sys.modules[TESTFN]


@reap_threads
Expand Down

0 comments on commit 41bbd82

Please sign in to comment.