This repository was archived by the owner on Nov 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Expand file tree Collapse file tree 3 files changed +14
-6
lines changed Original file line number Diff line number Diff line change 11CHANGELOG
22=========
33
4+ UNRELEASED
5+ ----------
6+
7+ * Fixed bug were an extra test would execute when ``-x/--exitfirst `` was used (`#139 `_).
8+
9+ .. _#139 : https://github.com/pytest-dev/pytest-subtests/pull/139
10+
4110.13.0 (2024-07-07)
512-------------------
613
Original file line number Diff line number Diff line change @@ -242,9 +242,6 @@ def __exit__(
242242 __tracebackhide__ = True
243243 try :
244244 if exc_val is not None :
245- if self .request .session .shouldfail :
246- return False
247-
248245 exc_info = ExceptionInfo .from_exception (exc_val )
249246 else :
250247 exc_info = None
@@ -275,6 +272,9 @@ def __exit__(
275272 node = self .request .node , call = call_info , report = sub_report
276273 )
277274
275+ if exc_val is not None :
276+ if self .request .session .shouldfail :
277+ return False
278278 return True
279279
280280
Original file line number Diff line number Diff line change @@ -593,15 +593,16 @@ def test_foo(subtests):
593593 assert False
594594
595595 with subtests.test("sub2"):
596- pass
596+ assert False
597597 """
598598 )
599599 result = pytester .runpytest ("--exitfirst" )
600- assert result .parseoutcomes ()["failed" ] == 1
600+ assert result .parseoutcomes ()["failed" ] == 2
601601 result .stdout .fnmatch_lines (
602602 [
603603 "*[[]sub1[]] SUBFAIL test_exitfirst.py::test_foo - assert False*" ,
604- "* stopping after 1 failures*" ,
604+ "FAILED test_exitfirst.py::test_foo - assert False" ,
605+ "* stopping after 2 failures*" ,
605606 ],
606607 consecutive = True ,
607608 )
You can’t perform that action at this time.
0 commit comments