~ubuntu-branches/ubuntu/quantal/python2.7/quantal

« back to all changes in this revision

Viewing changes to Doc/library/test.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-05-30 06:44:23 UTC
  • mto: (27.1.6 oneiric) (36.1.11 sid)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20110530064423-zj6auh76957umtm4
Tags: upstream-2.7.2~rc1
ImportĀ upstreamĀ versionĀ 2.7.2~rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
 
156
156
.. _regrtest:
157
157
 
158
 
Running tests using :mod:`test.regrtest`
159
 
----------------------------------------
 
158
Running tests using the command-line interface
 
159
----------------------------------------------
160
160
 
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.
169
170
 
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`.
181
181
 
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
186
 
regression tests.
 
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
 
186
tests.
187
187
 
188
188
 
189
189
:mod:`test.test_support` --- Utility functions for tests