[Python-checkins] cpython (merge 3.3 -> default): #17329: merge with 3.3.

ezio.melotti python-checkins at python.org
Wed Mar 27 19:16:50 CET 2013


http://hg.python.org/cpython/rev/53cc3dbb1918
changeset:   82976:53cc3dbb1918
parent:      82972:1ebefb6ae9a9
parent:      82975:4bf2a53b53b6
user:        Ezio Melotti <ezio.melotti at gmail.com>
date:        Wed Mar 27 20:13:59 2013 +0200
summary:
  #17329: merge with 3.3.

files:
  Doc/library/unittest.rst |  19 +++++++++++++------
  Lib/unittest/case.py     |   2 +-
  2 files changed, 14 insertions(+), 7 deletions(-)


diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -530,7 +530,7 @@
    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 @@
    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.
 
@@ -1571,7 +1578,7 @@
 
       If importing a module fails, for example due to a syntax error, then this
       will be recorded as a single error and discovery will continue.  If the
-      import failure is due to ``SkipTest`` being raised, it will be recorded
+      import failure is due to :exc:`SkipTest` being raised, it will be recorded
       as a skip instead of an error.
 
       If a test package name (directory with :file:`__init__.py`) matches the
@@ -1592,8 +1599,8 @@
       .. versionadded:: 3.2
 
       .. versionchanged:: 3.4
-         Modules that raise ``SkipTest`` on import are recorded as skips, not
-         errors.
+         Modules that raise :exc:`SkipTest` on import are recorded as skips,
+         not errors.
 
       .. versionchanged:: 3.4
          Paths are sorted before being imported to ensure execution order for a
@@ -2066,7 +2073,7 @@
 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.
 
 
@@ -2083,7 +2090,7 @@
 
 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.
 
 
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -23,7 +23,7 @@
     """
     Raise this exception in a test to skip it.
 
-    Usually you can use TestResult.skip() or one of the skipping decorators
+    Usually you can use TestCase.skipTest() or one of the skipping decorators
     instead of raising this directly.
     """
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list