[Python-checkins] bpo-31234: test_threaded_import: fix test_side_effect_import() (#3189)
Victor Stinner
webhook-mailer at python.org
Tue Aug 22 12:05:35 EDT 2017
https://github.com/python/cpython/commit/41bbd82b6b6a887e893974fa5cdaae7782ae6cac
commit: 41bbd82b6b6a887e893974fa5cdaae7782ae6cac
branch: master
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-08-22T18:05:32+02:00
summary:
bpo-31234: test_threaded_import: fix test_side_effect_import() (#3189)
* Don't leak the module into sys.modules
* Avoid dangling thread
files:
M Lib/test/test_threaded_import.py
diff --git a/Lib/test/test_threaded_import.py b/Lib/test/test_threaded_import.py
index a4cf1d70f1d..75c66b0ac75 100644
--- a/Lib/test/test_threaded_import.py
+++ b/Lib/test/test_threaded_import.py
@@ -230,7 +230,8 @@ def target():
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 @@ def target():
self.addCleanup(rmtree, '__pycache__')
importlib.invalidate_caches()
__import__(TESTFN)
+ del sys.modules[TESTFN]
@reap_threads
More information about the Python-checkins
mailing list