Skip to content

Commit f3ef8b3

Browse files
Joonalaiicemac
andauthored
Fix crash with setup errors and --rerun-except flag (#244)
* Fix crash with setup errors and --rerun-except flag --------- Co-authored-by: Michael Howitz <icemac@gmx.net>
1 parent 1765772 commit f3ef8b3

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ Changelog
77
- Fix crashitem names mismatch between client and server.
88
(`#172 <https://github.com/pytest-dev/pytest-rerunfailures/issues/172>`_)
99

10+
- Fix crash when setup fails with --rerun-except flag.
11+
(`#230 <https://github.com/pytest-dev/pytest-rerunfailures/issues/230>`_)
1012

1113
12.0 (2023-07-05)
1214
-----------------

test_pytest_rerunfailures.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,26 @@ def test_rerun_except_and_only_rerun(
616616
)
617617

618618

619+
def test_rerun_except_passes_setup_errors(testdir):
620+
testdir.makepyfile(
621+
"""
622+
import pytest
623+
624+
@pytest.fixture()
625+
def fixture_setup_fails(non_existent_fixture):
626+
return 1
627+
628+
def test_will_not_run(fixture_setup_fails):
629+
assert fixture_setup_fails == 1"""
630+
)
631+
632+
num_reruns = 1
633+
pytest_args = ["--reruns", str(num_reruns), "--rerun-except", "ValueError"]
634+
result = testdir.runpytest(*pytest_args)
635+
assert result.ret != pytest.ExitCode.INTERNAL_ERROR
636+
assert_outcomes(result, passed=0, error=1, rerun=num_reruns)
637+
638+
619639
@pytest.mark.parametrize(
620640
"condition, expected_reruns",
621641
[

0 commit comments

Comments
 (0)