]> granicus.if.org Git - python/commitdiff
Issue #25220, libregrtest: Call setup_python(ns) in the slaves
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Sep 2015 23:39:28 +0000 (01:39 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Sep 2015 23:39:28 +0000 (01:39 +0200)
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.

Lib/test/libregrtest/cmdline.py
Lib/test/libregrtest/main.py
Lib/test/libregrtest/runtest_mp.py
Lib/test/test_regrtest.py

index 19c52a2fe69f307aea09e6f6756316a8219c10b5..e55e53f45ea7bd60347f92618e5d5ab0a5405f31 100644 (file)
@@ -295,8 +295,6 @@ def _parse_args(args, **kwargs):
         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")
 
index df2329f2d3cc45b316dc6e0999e7ed908dc17a75..e68597038e1702f3dc02913fc960920305353f0a 100644 (file)
@@ -354,14 +354,15 @@ class Regrtest:
     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()
 
index 74424c14ba2637dfee4fc1e3377124154b8b5b63..47393aad8d1301db7a7dabd3122924e5e661b2c5 100644 (file)
@@ -13,7 +13,8 @@ except ImportError:
     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 @@ def run_tests_slave(slaveargs):
     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,
index 54bbfe4cd7643f96173f586e2f97fda0f4345d86..c277e10e7e637ec12e4afa905faa2eefb466b156 100644 (file)
@@ -214,7 +214,6 @@ class ParseArgsTestCase(unittest.TestCase):
                 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':