Message299629
In CPython >=3.3, "test" target of Makefile calls Tools/scripts/run_tests.py script.
This script contains:
def is_multiprocess_flag(arg):
return arg.startswith('-j') or arg.startswith('--multiprocess')
...
def main(regrtest_args):
...
if threading and not any(is_multiprocess_flag(arg) for arg in regrtest_args):
args.extend(['-j', '0']) # Use all CPU cores
In order to run tests sequentially, in CPython 3.5 and older branches, it is possible to set EXTRATESTOPTS with -j1:
make test EXTRATESTOPTS="-j1"
In CPython >=3.6, this workaround no longer works, because this code (Lib/test/regrtest.py in 3.5):
if ns.use_mp is not None:
if ns.use_mp <= 0:
# Use all cores + extras for tests that like to sleep
ns.use_mp = 2 + (os.cpu_count() or 1)
if ns.use_mp == 1:
ns.use_mp = None
Was changed into (Lib/test/libregrtest/cmdline.py in 3.6 and 3.7):
if ns.use_mp is not None:
if ns.use_mp <= 0:
# Use all cores + extras for tests that like to sleep
ns.use_mp = 2 + (os.cpu_count() or 1)
Currently the only remaining ways to run tests sequentially are to locally edit Tools/scripts/run_tests.py or to not use "test" target of Makefile and to run Lib/test/regrtest.py directly with appropriate options. |
|
Date |
User |
Action |
Args |
2017-08-01 18:57:38 | Arfrever | set | recipients:
+ Arfrever, vstinner |
2017-08-01 18:57:38 | Arfrever | set | messageid: <1501613858.46.0.0685506045585.issue31098@psf.upfronthosting.co.za> |
2017-08-01 18:57:38 | Arfrever | link | issue31098 messages |
2017-08-01 18:57:37 | Arfrever | create | |
|