mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-31234: test_threaded_import: fix test_side_effect_import() (#3189)
* Don't leak the module into sys.modules * Avoid dangling thread
This commit is contained in:
parent
830d7d2936
commit
41bbd82b6b
1 changed files with 3 additions and 1 deletions
|
@ -230,7 +230,8 @@ class ThreadedImportTests(unittest.TestCase):
|
|||
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"
|
||||
|
@ -241,6 +242,7 @@ class ThreadedImportTests(unittest.TestCase):
|
|||
self.addCleanup(rmtree, '__pycache__')
|
||||
importlib.invalidate_caches()
|
||||
__import__(TESTFN)
|
||||
del sys.modules[TESTFN]
|
||||
|
||||
|
||||
@reap_threads
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue