This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Arfrever
Recipients Arfrever, vstinner
Date 2017-08-01.18:57:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501613858.46.0.0685506045585.issue31098@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-08-01 18:57:38Arfreversetrecipients: + Arfrever, vstinner
2017-08-01 18:57:38Arfreversetmessageid: <1501613858.46.0.0685506045585.issue31098@psf.upfronthosting.co.za>
2017-08-01 18:57:38Arfreverlinkissue31098 messages
2017-08-01 18:57:37Arfrevercreate