diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-08-22 16:05:32 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-22 16:05:32 (GMT) |
commit | 41bbd82b6b6a887e893974fa5cdaae7782ae6cac (patch) | |
tree | 97b88714a6139896319f33acfa822be26b5960d9 | |
parent | 830d7d2936434ace113822294acce82f62cde41b (diff) | |
download | cpython-41bbd82b6b6a887e893974fa5cdaae7782ae6cac.zip cpython-41bbd82b6b6a887e893974fa5cdaae7782ae6cac.tar.gz cpython-41bbd82b6b6a887e893974fa5cdaae7782ae6cac.tar.bz2 |
bpo-31234: test_threaded_import: fix test_side_effect_import() (#3189)
* Don't leak the module into sys.modules
* Avoid dangling thread
-rw-r--r-- | Lib/test/test_threaded_import.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py index a4cf1d7..75c66b0 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -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 |