[Python-checkins] cpython: Issue #25220, libregrtest: Call setup_python(ns) in the slaves

victor.stinner python-checkins at python.org
Wed Sep 30 02:05:13 CEST 2015


https://hg.python.org/cpython/rev/b48ae54ed5be
changeset:   98427:b48ae54ed5be
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Sep 30 01:39:28 2015 +0200
summary:
  Issue #25220, libregrtest: Call setup_python(ns) in the slaves

Slaves (child processes running tests for regrtest -jN) now inherit
--memlimit/-M, --threshold/-t and --nowindows/-n options.

* -M, -t and -n are now supported with -jN
* Factorize code to run tests.
* run_test_in_subprocess() now pass the whole "ns" namespace to the child
  process.

files:
  Lib/test/libregrtest/cmdline.py    |  2 --
  Lib/test/libregrtest/main.py       |  5 +++--
  Lib/test/libregrtest/runtest_mp.py |  8 ++++----
  Lib/test/test_regrtest.py          |  1 -
  4 files changed, 7 insertions(+), 9 deletions(-)


diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -295,8 +295,6 @@
         parser.error("-T and -j don't go together!")
     if ns.use_mp and ns.findleaks:
         parser.error("-l and -j don't go together!")
-    if ns.use_mp and ns.memlimit:
-        parser.error("-M and -j don't go together!")
     if ns.failfast and not (ns.verbose or ns.verbose3):
         parser.error("-G/--failfast needs either -v or -W")
 
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -354,14 +354,15 @@
     def main(self, tests=None, **kwargs):
         self.ns = self.parse_args(kwargs)
 
-        setup_python(self.ns)
-
         if self.ns.slaveargs is not None:
             from test.libregrtest.runtest_mp import run_tests_slave
             run_tests_slave(self.ns.slaveargs)
+
         if self.ns.wait:
             input("Press any key to continue...")
 
+        setup_python(self.ns)
+
         self.find_tests(tests)
         self.run_tests()
 
diff --git a/Lib/test/libregrtest/runtest_mp.py b/Lib/test/libregrtest/runtest_mp.py
--- a/Lib/test/libregrtest/runtest_mp.py
+++ b/Lib/test/libregrtest/runtest_mp.py
@@ -13,7 +13,8 @@
     print("Multiprocess option requires thread support")
     sys.exit(2)
 
-from test.libregrtest.runtest import runtest, INTERRUPTED, CHILD_ERROR
+from test.libregrtest.runtest import runtest_ns, INTERRUPTED, CHILD_ERROR
+from test.libregrtest.setup import setup_python
 
 
 # Minimum duration of a test to display its duration or to mention that
@@ -58,11 +59,10 @@
     ns_dict, testname = json.loads(slaveargs)
     ns = types.SimpleNamespace(**ns_dict)
 
-    if ns.huntrleaks:
-        unittest.BaseTestSuite._cleanup = False
+    setup_python(ns)
 
     try:
-        result = runtest_ns(testname,  ns.verbose, ns.quiet, ns,
+        result = runtest_ns(testname,  ns.verbose, ns,
                             use_resources=ns.use_resources,
                             output_on_failure=ns.verbose3,
                             failfast=ns.failfast,
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -214,7 +214,6 @@
                 self.checkError([opt, 'foo'], 'invalid int value')
                 self.checkError([opt, '2', '-T'], "don't go together")
                 self.checkError([opt, '2', '-l'], "don't go together")
-                self.checkError([opt, '2', '-M', '4G'], "don't go together")
 
     def test_coverage(self):
         for opt in '-T', '--coverage':

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list