[Python-checkins] cpython (3.4): Issue #22104: Don't hold a reference to the loaded TestSuite in runtest_inner
zach.ware
python-checkins at python.org
Mon Aug 4 18:19:12 CEST 2014
http://hg.python.org/cpython/rev/9bca86812857
changeset: 91994:9bca86812857
branch: 3.4
parent: 91992:9ec2b429a607
user: Zachary Ware <zachary.ware at gmail.com>
date: Mon Aug 04 11:15:10 2014 -0500
summary:
Issue #22104: Don't hold a reference to the loaded TestSuite in runtest_inner
files:
Lib/test/regrtest.py | 6 ++++--
Misc/NEWS | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1273,8 +1273,10 @@
# tests. If not, use normal unittest test loading.
test_runner = getattr(the_module, "test_main", None)
if test_runner is None:
- tests = unittest.TestLoader().loadTestsFromModule(the_module)
- test_runner = lambda: support.run_unittest(tests)
+ def test_runner():
+ loader = unittest.TestLoader()
+ tests = loader.loadTestsFromModule(the_module)
+ support.run_unittest(tests)
test_runner()
if huntrleaks:
refleak = dash_R(the_module, test, test_runner, huntrleaks)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -239,6 +239,9 @@
Tests
-----
+- Issue #22104: regrtest.py no longer holds a reference to the suite of tests
+ loaded from test modules that don't define test_main().
+
- Issue #22002: Added ``load_package_tests`` function to test.support and used
it to implement/augment test discovery in test_asyncio, test_email,
test_importlib, test_json, and test_tools.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list