New submission from Arfrever Frehtes Taifersar Arahesis:

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.

----------
assignee: haypo
components: Tests
messages: 299629
nosy: Arfrever, haypo
priority: normal
severity: normal
status: open
title: test target of Makefile always run tests in parallel mode
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31098>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to