diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2017-09-13 10:27:45 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2017-09-13 10:27:45 (GMT) |
commit | 89bfc9b0d9033f7c9f086c7281a31a489fe1136f (patch) | |
tree | 27826b9d3176d0900fd46a8f41b9f883474aeb96 /Lib/test | |
parent | 1b00bddd5c4a5728b15eee5a27ed3f78a173ef64 (diff) | |
download | cpython-89bfc9b0d9033f7c9f086c7281a31a489fe1136f.zip cpython-89bfc9b0d9033f7c9f086c7281a31a489fe1136f.tar.gz cpython-89bfc9b0d9033f7c9f086c7281a31a489fe1136f.tar.bz2 |
[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 41bbd82b6b6a887e893974fa5cdaae7782ae6cac)
Diffstat (limited to 'Lib/test')
-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 9b2d9a6..f42c900 100644 --- a/Lib/test/test_threaded_import.py +++ b/Lib/test/test_threaded_import.py @@ -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 |