[docs] There is no standard TestCase.runTest implementation (issue 22153)

vadmium+py at gmail.com vadmium+py at gmail.com
Mon Nov 10 22:24:13 CET 2014


Reviewers: rbcollins, ezio.melotti,


http://bugs.python.org/review/22153/diff/12734/Doc/library/unittest.rst
File Doc/library/unittest.rst (right):

http://bugs.python.org/review/22153/diff/12734/Doc/library/unittest.rst#newcode1561
Doc/library/unittest.rst:1561: If no methods with the usual name prefix
are found, but the ``runTest()`` method is implemented, there will be a
single test case using that method.
I think this was my original wording. What about something like

A test case instance is created for each method named by
getTestCaseNames(). By default these are the method names beginning with
“test”. If getTestCaseNames() returns no methods, but the runTest()
method is implemented, a single test case is created for that method
instead.

Personally, I use runTest() for test case classes designed with a single
test method in mind. But I’m not sure the documentation should suggest
that.



Please review this at http://bugs.python.org/review/22153/

Affected files:
  Doc/library/unittest.rst


diff -r 3d45155b7b9b Doc/library/unittest.rst
--- a/Doc/library/unittest.rst	Sat Aug 16 22:54:24 2014 +0530
+++ b/Doc/library/unittest.rst	Sun Aug 17 01:58:13 2014 -0700
@@ -653,10 +653,8 @@
    kinds of failure.
 
    Each instance of :class:`TestCase` will run a single base method: the method
-   named *methodName*.  However, the standard implementation of the default
-   *methodName*, ``runTest()``, will run every method starting with ``test``
-   as an individual test, and count successes and failures accordingly.
-   Therefore, in most uses of :class:`TestCase`, you will neither change
+   named *methodName*.
+  In most uses of :class:`TestCase`, you will neither change
    the *methodName* nor reimplement the default ``runTest()`` method.
 
    .. versionchanged:: 3.2
@@ -1560,6 +1558,8 @@
       Return a suite of all tests cases contained in the :class:`TestCase`\ -derived
       :class:`testCaseClass`.
 
+      If no methods with the usual name prefix are found, but the ``runTest()`` method is implemented, there will be a single test case using that method.
+
 
    .. method:: loadTestsFromModule(module)
 




More information about the docs mailing list