From: Antoine Pitrou Date: Wed, 23 Mar 2011 19:17:45 +0000 (+0100) Subject: Allow "-j0" as an argument to regrtest, to automatically select an X-Git-Tag: v3.3.0a1~2780^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6ab79d9d5bed43e6e2d6b1b27ab319c02fa1716a;p=python Allow "-j0" as an argument to regrtest, to automatically select an appropriate number of parallel workers. --- diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 1e72f800b9..a00f15aae4 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -374,6 +374,13 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, forever = True elif o in ('-j', '--multiprocess'): use_mp = int(a) + if use_mp <= 0: + try: + import multiprocessing + # Use all cores + extras for tests that like to sleep + use_mp = 2 + multiprocessing.cpu_count() + except (ImportError, NotImplementedError): + use_mp = 3 elif o == '--header': header = True elif o == '--slaveargs':