Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfc104e

Browse files
committed
#14558: merge with 3.2.
2 parents d343391 + 3d6d7a5 commit cfc104e

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

Doc/library/unittest.rst

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,9 +1920,10 @@ Loading and running tests
19201920
testLoader=unittest.defaultTestLoader, exit=True, verbosity=1, \
19211921
failfast=None, catchbreak=None, buffer=None, warnings=None)
19221922

1923-
A command-line program that runs a set of tests; this is primarily for making
1924-
test modules conveniently executable. The simplest use for this function is to
1925-
include the following line at the end of a test script::
1923+
A command-line program that loads a set of tests from *module* and runs them;
1924+
this is primarily for making test modules conveniently executable.
1925+
The simplest use for this function is to include the following line at the
1926+
end of a test script::
19261927

19271928
if __name__ == '__main__':
19281929
unittest.main()
@@ -1933,18 +1934,25 @@ Loading and running tests
19331934
if __name__ == '__main__':
19341935
unittest.main(verbosity=2)
19351936

1937+
The *argv* argument can be a list of options passed to the program, with the
1938+
first element being the program name. If not specified or ``None``,
1939+
the values of :data:`sys.argv` are used.
1940+
19361941
The *testRunner* argument can either be a test runner class or an already
19371942
created instance of it. By default ``main`` calls :func:`sys.exit` with
19381943
an exit code indicating success or failure of the tests run.
19391944

1945+
The *testLoader* argument has to be a :class:`TestLoader` instance,
1946+
and defaults to :data:`defaultTestLoader`.
1947+
19401948
``main`` supports being used from the interactive interpreter by passing in the
19411949
argument ``exit=False``. This displays the result on standard output without
19421950
calling :func:`sys.exit`::
19431951

19441952
>>> from unittest import main
19451953
>>> main(module='test_module', exit=False)
19461954

1947-
The ``failfast``, ``catchbreak`` and ``buffer`` parameters have the same
1955+
The *failfast*, *catchbreak* and *buffer* parameters have the same
19481956
effect as the same-name `command-line options`_.
19491957

19501958
The *warning* argument specifies the :ref:`warning filter <warning-filter>`
@@ -1956,11 +1964,11 @@ Loading and running tests
19561964
This stores the result of the tests run as the ``result`` attribute.
19571965

19581966
.. versionchanged:: 3.1
1959-
The ``exit`` parameter was added.
1967+
The *exit* parameter was added.
19601968

19611969
.. versionchanged:: 3.2
1962-
The ``verbosity``, ``failfast``, ``catchbreak``, ``buffer``
1963-
and ``warnings`` parameters were added.
1970+
The *verbosity*, *failfast*, *catchbreak*, *buffer*
1971+
and *warnings* parameters were added.
19641972

19651973

19661974
load_tests Protocol

0 commit comments

Comments
 (0)