mirror of
https://github.com/AdaCore/cpython.git
synced 2026-02-12 12:57:15 -08: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user