Kaydet (Commit) 89bfc9b0 authored tarafından Miss Islington (bot)'s avatar Miss Islington (bot) Kaydeden (comit) Victor Stinner

[3.6] bpo-31234: test_threaded_import: fix test_side_effect_import() (GH-3189) (#3537)

* Don't leak the module into sys.modules
* Avoid dangling thread
(cherry picked from commit 41bbd82b)
üst 1b00bddd
......@@ -221,7 +221,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"
......@@ -232,6 +233,7 @@ class ThreadedImportTests(unittest.TestCase):
self.addCleanup(rmtree, '__pycache__')
importlib.invalidate_caches()
__import__(TESTFN)
del sys.modules[TESTFN]
@reap_threads
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment