summaryrefslogtreecommitdiffstats
path: root/Doc/library/unittest.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r--Doc/library/unittest.rst40
1 files changed, 23 insertions, 17 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index c36ff87..f430c17 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -220,26 +220,26 @@ failfast, catch and buffer command line options
unittest supports three command options.
-* -f / --failfast
+* :option:`-b` / :option:`--buffer`
- Stop the test run on the first error or failure.
+ The standard output and standard error streams are buffered during the test
+ run. Output during a passing test is discarded. Output is echoed normally
+ on test fail or error and is added to the failure messages.
-* -c / --catch
+* :option:`-c` / :option:`--catch`
- Control-c during the test run waits for the current test to end and then
- reports all the results so far. A second control-c raises the normal
- ``KeyboardInterrupt`` exception.
+ Control-C during the test run waits for the current test to end and then
+ reports all the results so far. A second control-C raises the normal
+ :exc:`KeyboardInterrupt` exception.
See `Signal Handling`_ for the functions that provide this functionality.
-* -b / --buffer
+* :option:`-f` / :option:`--failfast`
- The standard out and standard error streams are buffered during the test
- run. Output during a passing test is discarded. Output is echoed normally
- on test fail or error and is added to the failure messages.
+ Stop the test run on the first error or failure.
.. versionadded:: 3.2
- The command line options ``-c``, ``-b`` and ``-f`` where added.
+ The command line options ``-c``, ``-b`` and ``-f`` were added.
The command line can also be used for test discovery, for running all of the
tests in a project or just a subset.
@@ -270,8 +270,9 @@ The ``discover`` sub-command has the following options:
-t directory Top level directory of project (default to
start directory)
-The -s, -p, & -t options can be passsed in as positional arguments. The
-following two command lines are equivalent::
+The :option:`-s`, :option:`-p`, and :option:`-t` options can be passed in
+as positional arguments in that order. The following two command lines
+are equivalent::
python -m unittest discover -s project_directory -p '*_test.py'
python -m unittest discover project_directory '*_test.py'
@@ -829,6 +830,11 @@ Test cases
compare equal, the test will fail with the explanation given by *msg*, or
:const:`None`.
+ If *delta* is supplied instead of *places* then the difference
+ between *first* and *second* must be less than *delta*.
+
+ Supplying both *delta* and *places* raises a ``TypeError``.
+
.. versionchanged:: 3.2
Objects that compare equal are automatically almost equal.
Added the ``delta`` keyword argument.
@@ -849,7 +855,7 @@ Test cases
compare equal, the test will fail with the explanation given by *msg*, or
:const:`None`.
- If *delta* is supplied instead of *places* then the the difference
+ If *delta* is supplied instead of *places* then the difference
between *first* and *second* must be more than *delta*.
Supplying both *delta* and *places* raises a ``TypeError``.
@@ -1902,12 +1908,12 @@ instead of as an error.
Signal Handling
---------------
-The -c / --catch command line option to unittest, along with the ``catchbreak``
+The :option:`-c`/:option:`--catch` command line option to unittest, along with the ``catchbreak``
parameter to :func:`unittest.main()`, provide more friendly handling of
-control-c during a test run. With catch break behavior enabled control-c will
+control-C during a test run. With catch break behavior enabled control-C will
allow the currently running test to complete, and the test run will then end
and report all the results so far. A second control-c will raise a
-``KeyboardInterrupt`` in the usual way.
+:exc:`KeyboardInterrupt` in the usual way.
The control-c handling signal handler attempts to remain compatible with code or
tests that install their own :const:`signal.SIGINT` handler. If the ``unittest``