158
Running tests using :mod:`test.regrtest`
159
----------------------------------------
158
Running tests using the command-line interface
159
----------------------------------------------
161
:mod:`test.regrtest` can be used as a script to drive Python's regression test
162
suite. Running the script by itself automatically starts running all regression
161
The :mod:`test.regrtest` module can be run as a script to drive Python's regression
162
test suite, thanks to the :option:`-m` option: :program:`python -m test.regrtest`.
163
Running the script by itself automatically starts running all regression
163
164
tests in the :mod:`test` package. It does this by finding all modules in the
164
165
package whose name starts with ``test_``, importing them, and executing the
165
166
function :func:`test_main` if present. The names of tests to execute may also
166
167
be passed to the script. Specifying a single regression test (:program:`python
167
regrtest.py` :option:`test_spam.py`) will minimize output and only print
168
whether the test passed or failed and thus minimize output.
168
-m test.regrtest test_spam`) will minimize output and only print whether
169
the test passed or failed and thus minimize output.
170
171
Running :mod:`test.regrtest` directly allows what resources are available for
171
172
tests to use to be set. You do this by using the :option:`-u` command-line
172
option. Run :program:`python regrtest.py` :option:`-uall` to turn on all
173
resources; specifying :option:`all` as an option for :option:`-u` enables all
173
option. Run :program:`python -m test.regrtest -uall` to turn on all
174
resources; specifying ``all`` as an option for ``-u`` enables all
174
175
possible resources. If all but one resource is desired (a more common case), a
175
176
comma-separated list of resources that are not desired may be listed after
176
:option:`all`. The command :program:`python regrtest.py`
177
:option:`-uall,-audio,-largefile` will run :mod:`test.regrtest` with all
178
resources except the :option:`audio` and :option:`largefile` resources. For a
179
list of all resources and more command-line options, run :program:`python
180
regrtest.py` :option:`-h`.
177
``all``. The command :program:`python -m test.regrtest -uall,-audio,-largefile`
178
will run :mod:`test.regrtest` with all resources except the ``audio`` and
179
``largefile`` resources. For a list of all resources and more command-line
180
options, run :program:`python -m test.regrtest -h`.
182
182
Some other ways to execute the regression tests depend on what platform the
183
tests are being executed on. On Unix, you can run :program:`make`
184
:option:`test` at the top-level directory where Python was built. On Windows,
185
executing :program:`rt.bat` from your :file:`PCBuild` directory will run all
183
tests are being executed on. On Unix, you can run :program:`make test` at the
184
top-level directory where Python was built. On Windows, executing
185
:program:`rt.bat` from your :file:`PCBuild` directory will run all regression
189
189
:mod:`test.test_support` --- Utility functions for tests