5.4.2 Running tests using test.regrtest

Python PEP

5.4.2 Running tests using test.regrtest

test.regrtest can be used as a script to drive Python's regression test suite. Running the script by itself automatically starts running all regression tests in the test package. It does this by finding all modules in the package whose name starts with "test_", importing them, and executing the function test_main() if present. The names of tests to execute may also be passed to the script. Specifying a single regression test (python regrtest.py test_spam.py) will minimize output and only print whether the test passed or failed and thus minimize output.

Running test.regrtest directly allows what resources are available for tests to use to be set. You do this by using the -u command-line option. Run python regrtest.py -uall to turn on all resources; specifying all as an option for -u enables all possible resources. If all but one resource is desired (a more common case), a comma-separated list of resources that are not desired may be listed after all. The command python regrtest.py -uall,-audio,-largefile will run test.regrtest with all resources except the audio and largefile resources. For a list of all resources and more command-line options, run python regrtest.py -h.

Some other ways to execute the regression tests depend on what platform the tests are being executed on. On Unix, you can run make test at the top-level directory where Python was built. On Windows, executing rt.bat from your PCBuild directory will run all regression tests.

See About this document... for information on suggesting changes.