python / cpython

The Python programming language
https://www.python.org
Other
63.49k stars 30.4k forks source link

Unify ways to run the Python test suite #109566

Closed vstinner closed 1 year ago

vstinner commented 1 year ago

There are at least 15 known ways to run the Python test suite. IMO it's too much, it's hard to keep all these code paths consistent. IMO python -m test should be enough to fit all use cases.

Maybe we need a --ci, --buildbot, or --strict option which would run tests is "strict" mode.


Portable way to run tests:

./python -m test
./python -m test.regrtest
./python -m test.libregrtest
./python -m test.autotest

./python Lib/test/regrtest.py
./python Lib/test/autotest.py

./python -c 'from test import autotest'

The main drawback is that running ./python doesn't work when Python is built with ./configure --enable-shared, and it doesn't work when Python is cross-compiled (WASM/WASI buildbots). Moreover, on macOS, ./python.exe must be run instead. On Windows, it's just python.

Unix, from Python source code:

make buildbottest TESTOPTS="..."
make test
make testall
make testuniversal
make hostrunnertest

./python Tools/scripts/run_tests.py

Windows, from Python source code:

PCbuild\rt.bat
Tools\buildbot\test.bat


GitHub Action workflow uses, .github/workflows/build.yml:

Buildbot use, master/custom/factories.py:

Linked PRs

vstinner commented 1 year ago

Python options and regrtest options are now handled by new --fast-ci and --slow-ci options of regrtest.