summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-03-27 18:12:55 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-03-27 18:12:55 (GMT)
commit184e59357e1444d32938d6f2b829b618f1eb8790 (patch)
tree93dc32bd0ad9b430ab9f514d1e9f9e413ca25211 /Doc/library
parent768f6a53601a6c4e0b914aaedb977dd2ca97532a (diff)
parent265281ac02d4ab82a8acdd38a1c38c4ecd9ce60d (diff)
downloadcpython-184e59357e1444d32938d6f2b829b618f1eb8790.zip
cpython-184e59357e1444d32938d6f2b829b618f1eb8790.tar.gz
cpython-184e59357e1444d32938d6f2b829b618f1eb8790.tar.bz2
#17329: merge with 3.2.
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/unittest.rst13
1 files changed, 10 insertions, 3 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index bba8dbe..c44ab23 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -530,7 +530,7 @@ the test unless the passed object has a certain attribute::
def skipUnlessHasattr(obj, attr):
if hasattr(obj, attr):
return lambda func: func
- return unittest.skip("{0!r} doesn't have {1!r}".format(obj, attr))
+ return unittest.skip("{!r} doesn't have {!r}".format(obj, attr))
The following decorators implement test skipping and expected failures:
@@ -552,6 +552,13 @@ The following decorators implement test skipping and expected failures:
Mark the test as an expected failure. If the test fails when run, the test
is not counted as a failure.
+.. exception:: SkipTest(reason)
+
+ This exception is raised to skip a test.
+
+ Usually you can use :meth:`TestCase.skipTest` or one of the skipping
+ decorators instead of raising this directly.
+
Skipped tests will not have :meth:`setUp` or :meth:`tearDown` run around them.
Skipped classes will not have :meth:`setUpClass` or :meth:`tearDownClass` run.
@@ -1958,7 +1965,7 @@ then you must call up to them yourself. The implementations in
If an exception is raised during a ``setUpClass`` then the tests in the class
are not run and the ``tearDownClass`` is not run. Skipped classes will not
have ``setUpClass`` or ``tearDownClass`` run. If the exception is a
-``SkipTest`` exception then the class will be reported as having been skipped
+:exc:`SkipTest` exception then the class will be reported as having been skipped
instead of as an error.
@@ -1975,7 +1982,7 @@ These should be implemented as functions::
If an exception is raised in a ``setUpModule`` then none of the tests in the
module will be run and the ``tearDownModule`` will not be run. If the exception is a
-``SkipTest`` exception then the module will be reported as having been skipped
+:exc:`SkipTest` exception then the module will be reported as having been skipped
instead of as an error.