summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2012-04-30 16:11:11 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2012-04-30 16:11:11 (GMT)
commitcfc104ee76dfcb592a0c0dcfaf3e65958fcabba4 (patch)
tree2f2c6182211c66bb046b5b57f07e2a33c3b5d9f5 /Doc
parentd3433918e762cacf06554f4bf54a136de6c32ab8 (diff)
parent3d6d7a5e158cc8b7b6258b8ec0463b5540487f72 (diff)
downloadcpython-cfc104ee76dfcb592a0c0dcfaf3e65958fcabba4.zip
cpython-cfc104ee76dfcb592a0c0dcfaf3e65958fcabba4.tar.gz
cpython-cfc104ee76dfcb592a0c0dcfaf3e65958fcabba4.tar.bz2
#14558: merge with 3.2.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/unittest.rst22
1 files changed, 15 insertions, 7 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index df1ff92..0af9038 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1920,9 +1920,10 @@ Loading and running tests
testLoader=unittest.defaultTestLoader, exit=True, verbosity=1, \
failfast=None, catchbreak=None, buffer=None, warnings=None)
- A command-line program that runs a set of tests; this is primarily for making
- test modules conveniently executable. The simplest use for this function is to
- include the following line at the end of a test script::
+ A command-line program that loads a set of tests from *module* and runs them;
+ this is primarily for making test modules conveniently executable.
+ The simplest use for this function is to include the following line at the
+ end of a test script::
if __name__ == '__main__':
unittest.main()
@@ -1933,10 +1934,17 @@ Loading and running tests
if __name__ == '__main__':
unittest.main(verbosity=2)
+ The *argv* argument can be a list of options passed to the program, with the
+ first element being the program name. If not specified or ``None``,
+ the values of :data:`sys.argv` are used.
+
The *testRunner* argument can either be a test runner class or an already
created instance of it. By default ``main`` calls :func:`sys.exit` with
an exit code indicating success or failure of the tests run.
+ The *testLoader* argument has to be a :class:`TestLoader` instance,
+ and defaults to :data:`defaultTestLoader`.
+
``main`` supports being used from the interactive interpreter by passing in the
argument ``exit=False``. This displays the result on standard output without
calling :func:`sys.exit`::
@@ -1944,7 +1952,7 @@ Loading and running tests
>>> from unittest import main
>>> main(module='test_module', exit=False)
- The ``failfast``, ``catchbreak`` and ``buffer`` parameters have the same
+ The *failfast*, *catchbreak* and *buffer* parameters have the same
effect as the same-name `command-line options`_.
The *warning* argument specifies the :ref:`warning filter <warning-filter>`
@@ -1956,11 +1964,11 @@ Loading and running tests
This stores the result of the tests run as the ``result`` attribute.
.. versionchanged:: 3.1
- The ``exit`` parameter was added.
+ The *exit* parameter was added.
.. versionchanged:: 3.2
- The ``verbosity``, ``failfast``, ``catchbreak``, ``buffer``
- and ``warnings`` parameters were added.
+ The *verbosity*, *failfast*, *catchbreak*, *buffer*
+ and *warnings* parameters were added.
load_tests Protocol