summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2014-08-04 16:15:10 (GMT)
committerZachary Ware <zachary.ware@gmail.com>2014-08-04 16:15:10 (GMT)
commit69fb6a41c56a6a92f091108c1429d406cc8d0296 (patch)
tree9778017ab2640bc55bd302889de4c3c224473792 /Lib/test/regrtest.py
parentd577480197f7cc427ac75deaebae3106399a9cd3 (diff)
downloadcpython-69fb6a41c56a6a92f091108c1429d406cc8d0296.zip
cpython-69fb6a41c56a6a92f091108c1429d406cc8d0296.tar.gz
cpython-69fb6a41c56a6a92f091108c1429d406cc8d0296.tar.bz2
Issue #22104: Don't hold a reference to the loaded TestSuite in runtest_inner
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index c1c831f..b633631 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1273,8 +1273,10 @@ def runtest_inner(test, verbose, quiet,
# 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)