classification
Title: unittest.TestCase.subTest causes all subsequent tests to be skipped in failfast mode
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.5, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Trey.Cucco, ethan.furman, ezio.melotti, michael.foord, pitrou, python-dev, rbcollins
Priority: normal Keywords: patch

Created on 2014-11-17 22:18 by Trey.Cucco, last changed 2014-11-23 15:06 by pitrou. This issue is now closed.

Files
File name Uploaded Description Edit
utbug.py Trey.Cucco, 2014-11-17 22:18 A python script demonstrating the bug
subtests_failfast.patch pitrou, 2014-11-21 00:14 review
Messages (4)
msg231305 - (view) Author: Trey Cucco (Trey.Cucco) Date: 2014-11-17 22:18
When running a test suite with the -f flag (--failfast), unittest seems to stop running tests once it exits a with self.subTest block.

In the attached script, run it without -f and test_b will run and fail. Run it with the -f flag and only the test_a test will run. test_b will not run and no errors will be reported.

I noticed this bug in 3.4.1 on OS X
msg231449 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-11-21 00:14
Here is a patch.
msg231468 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2014-11-21 09:20
Looks good, thanks for the quick response.
msg231562 - (view) Author: Roundup Robot (python-dev) Date: 2014-11-23 15:01
New changeset 993e8f795194 by Antoine Pitrou in branch '3.4':
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
https://hg.python.org/cpython/rev/993e8f795194

New changeset 04103cece49d by Antoine Pitrou in branch 'default':
Issue #22894: TestCase.subTest() would cause the test suite to be stopped when in failfast mode, even in the absence of failures.
https://hg.python.org/cpython/rev/04103cece49d
History
Date User Action Args
2014-11-23 15:06:40pitrousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2014-11-23 15:01:31python-devsetnosy: + python-dev
messages: + msg231562
2014-11-21 09:20:40michael.foordsetmessages: + msg231468
2014-11-21 00:14:11pitrousetfiles: + subtests_failfast.patch
versions: + Python 3.5
messages: + msg231449

keywords: + patch
stage: patch review
2014-11-20 11:37:51michael.foordsetnosy: + pitrou
2014-11-18 22:18:44ethan.furmansetnosy: + ethan.furman
2014-11-17 22:35:48ned.deilysetnosy: + rbcollins, ezio.melotti, michael.foord, - ronaldoussoren, ned.deily
components: - macOS
2014-11-17 22:18:09Trey.Cuccocreate