summaryrefslogtreecommitdiffstats
path: root/Doc/library/unittest.rst
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2013-08-28 18:28:38 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2013-08-28 18:28:38 (GMT)
commiteb9736845182a732b2fcfb32730984d7c6fff7f3 (patch)
tree8f613d582fd60002494fa0f8e4173d730c444abc /Doc/library/unittest.rst
parent6a53af893ad2708af8dda71515254abd7118d7de (diff)
downloadcpython-eb9736845182a732b2fcfb32730984d7c6fff7f3.zip
cpython-eb9736845182a732b2fcfb32730984d7c6fff7f3.tar.gz
cpython-eb9736845182a732b2fcfb32730984d7c6fff7f3.tar.bz2
Issue #11798: TestSuite now drops references to own tests after execution.
Diffstat (limited to 'Doc/library/unittest.rst')
-rw-r--r--Doc/library/unittest.rst15
1 files changed, 12 insertions, 3 deletions
diff --git a/Doc/library/unittest.rst b/Doc/library/unittest.rst
index 66e427a..412bee7 100644
--- a/Doc/library/unittest.rst
+++ b/Doc/library/unittest.rst
@@ -1470,15 +1470,24 @@ Grouping tests
Tests grouped by a :class:`TestSuite` are always accessed by iteration.
Subclasses can lazily provide tests by overriding :meth:`__iter__`. Note
- that this method maybe called several times on a single suite
- (for example when counting tests or comparing for equality)
- so the tests returned must be the same for repeated iterations.
+ that this method may be called several times on a single suite (for
+ example when counting tests or comparing for equality) so the tests
+ returned by repeated iterations before :meth:`TestSuite.run` must be the
+ same for each call iteration. After :meth:`TestSuite.run`, callers should
+ not rely on the tests returned by this method unless the caller uses a
+ subclass that overrides :meth:`TestSuite._removeTestAtIndex` to preserve
+ test references.
.. versionchanged:: 3.2
In earlier versions the :class:`TestSuite` accessed tests directly rather
than through iteration, so overriding :meth:`__iter__` wasn't sufficient
for providing tests.
+ .. versionchanged:: 3.4
+ In earlier versions the :class:`TestSuite` held references to each
+ :class:`TestCase` after :meth:`TestSuite.run`. Subclasses can restore
+ that behavior by overriding :meth:`TestSuite._removeTestAtIndex`.
+
In the typical usage of a :class:`TestSuite` object, the :meth:`run` method
is invoked by a :class:`TestRunner` rather than by the end-user test harness.