Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
cfc104ee
Commit
cfc104ee
authored
Apr 30, 2012
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#14558: merge with 3.2.
parents
d3433918
3d6d7a5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
7 deletions
+15
-7
Doc/library/unittest.rst
Doc/library/unittest.rst
+15
-7
No files found.
Doc/library/unittest.rst
View file @
cfc104ee
...
@@ -1920,9 +1920,10 @@ Loading and running tests
...
@@ -1920,9 +1920,10 @@ Loading and running tests
testLoader=unittest.defaultTestLoader, exit=True, verbosity=1, \
testLoader=unittest.defaultTestLoader, exit=True, verbosity=1, \
failfast=None, catchbreak=None, buffer=None, warnings=None)
failfast=None, catchbreak=None, buffer=None, warnings=None)
A command-line program that runs a set of tests; this is primarily for making
A command-line program that loads a set of tests from *module* and runs them;
test modules conveniently executable. The simplest use for this function is to
this is primarily for making test modules conveniently executable.
include the following line at the end of a test script::
The simplest use for this function is to include the following line at the
end of a test script::
if __name__ == '__main__':
if __name__ == '__main__':
unittest.main()
unittest.main()
...
@@ -1933,10 +1934,17 @@ Loading and running tests
...
@@ -1933,10 +1934,17 @@ Loading and running tests
if __name__ == '__main__':
if __name__ == '__main__':
unittest.main(verbosity=2)
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
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
created instance of it. By default ``main`` calls :func:`sys.exit` with
an exit code indicating success or failure of the tests run.
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
``main`` supports being used from the interactive interpreter by passing in the
argument ``exit=False``. This displays the result on standard output without
argument ``exit=False``. This displays the result on standard output without
calling :func:`sys.exit`::
calling :func:`sys.exit`::
...
@@ -1944,7 +1952,7 @@ Loading and running tests
...
@@ -1944,7 +1952,7 @@ Loading and running tests
>>> from unittest import main
>>> from unittest import main
>>> main(module='test_module', exit=False)
>>> 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`_.
effect as the same-name `command-line options`_.
The *warning* argument specifies the :ref:`warning filter <warning-filter>`
The *warning* argument specifies the :ref:`warning filter <warning-filter>`
...
@@ -1956,11 +1964,11 @@ Loading and running tests
...
@@ -1956,11 +1964,11 @@ Loading and running tests
This stores the result of the tests run as the ``result`` attribute.
This stores the result of the tests run as the ``result`` attribute.
.. versionchanged:: 3.1
.. versionchanged:: 3.1
The
``exit``
parameter was added.
The
*exit*
parameter was added.
.. versionchanged:: 3.2
.. versionchanged:: 3.2
The
``verbosity``, ``failfast``, ``catchbreak``, ``buffer``
The
*verbosity*, *failfast*, *catchbreak*, *buffer*
and
``warnings``
parameters were added.
and
*warnings*
parameters were added.
load_tests Protocol
load_tests Protocol
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment