Allow "-j0" as an argument to regrtest, to automatically select an

appropriate number of parallel workers.
This commit is contained in:
Antoine Pitrou 2011-03-23 20:17:45 +01:00
parent 5066b03361
commit 6ab79d9d5b
1 changed files with 7 additions and 0 deletions

View File

@ -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':