summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/result.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-11-23 14:55:11 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2014-11-23 14:55:11 (GMT)
commit18f22989dd73c7b9c09a746e89cb9d7ce7243d1d (patch)
tree88e0aaf2130047e6e6f85f823bf313a4b4fa1a8e /Lib/unittest/result.py
parenta21de3d45ec2aebf899712cbd0e44eba9611d2af (diff)
downloadcpython-18f22989dd73c7b9c09a746e89cb9d7ce7243d1d.zip
cpython-18f22989dd73c7b9c09a746e89cb9d7ce7243d1d.tar.gz
cpython-18f22989dd73c7b9c09a746e89cb9d7ce7243d1d.tar.bz2
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
Diffstat (limited to 'Lib/unittest/result.py')
-rw-r--r--Lib/unittest/result.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/unittest/result.py b/Lib/unittest/result.py
index b967a60..8e0a643 100644
--- a/Lib/unittest/result.py
+++ b/Lib/unittest/result.py
@@ -121,7 +121,6 @@ class TestResult(object):
self.failures.append((test, self._exc_info_to_string(err, test)))
self._mirrorOutput = True
- @failfast
def addSubTest(self, test, subtest, err):
"""Called at the end of a subtest.
'err' is None if the subtest ended successfully, otherwise it's a
@@ -130,6 +129,8 @@ class TestResult(object):
# By default, we don't do anything with successful subtests, but
# more sophisticated test results might want to record them.
if err is not None:
+ if getattr(self, 'failfast', False):
+ self.stop()
if issubclass(err[0], test.failureException):
errors = self.failures
else: