summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2017-09-13 10:27:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-09-13 10:27:45 (GMT)
commit89bfc9b0d9033f7c9f086c7281a31a489fe1136f (patch)
tree27826b9d3176d0900fd46a8f41b9f883474aeb96 /Lib/test
parent1b00bddd5c4a5728b15eee5a27ed3f78a173ef64 (diff)
downloadcpython-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.py4
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