[Python-checkins] cpython (merge 3.4 -> 3.5): Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.

robert.collins python-checkins at python.org
Wed Jul 22 20:40:38 CEST 2015


https://hg.python.org/cpython/rev/10f5a7fa26d5
changeset:   97003:10f5a7fa26d5
branch:      3.5
parent:      96999:267ea1731a91
parent:      97002:eefc157b3096
user:        Robert Collins <rbtcollins at hp.com>
date:        Thu Jul 23 06:39:06 2015 +1200
summary:
  Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.

files:
  Doc/library/unittest.rst |  12 ++++++++----
  Misc/ACKS                |   1 +
  Misc/NEWS                |   2 ++
  3 files changed, 11 insertions(+), 4 deletions(-)


diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -651,10 +651,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
@@ -1572,6 +1570,12 @@
       Return a suite of all tests cases contained in the :class:`TestCase`\ -derived
       :class:`testCaseClass`.
 
+      A test case instance is created for each method named by
+      :meth:`getTestCaseNames`. By default these are the method names
+      beginning with ``test``. If :meth:`getTestCaseNames` returns no
+      methods, but the :meth:`runTest` method is implemented, a single test
+      case is created for that method instead.
+
 
    .. method:: loadTestsFromModule(module, pattern=None)
 
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -1584,3 +1584,4 @@
 Ignacio Rossi
 Laurent De Buyst
 Nicola Palumbo
+evilzero
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -25,6 +25,8 @@
 Library
 -------
 
+- Issue #22153: Improve unittest docs. Patch from Martin Panter and evilzero.
+
 - Issue #24580: Symbolic group references to open group in re patterns now are
   explicitly forbidden as well as numeric group references.
 

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


More information about the Python-checkins mailing list