Skip to content

Commit

Permalink
Fix crash with setup errors and --rerun-except flag (#244)
Browse files Browse the repository at this point in the history
* Fix crash with setup errors and --rerun-except flag

---------

Co-authored-by: Michael Howitz <icemac@gmx.net>
  • Loading branch information
Joonalai and icemac authored Nov 22, 2023
1 parent 1765772 commit f3ef8b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Changelog
- Fix crashitem names mismatch between client and server.
(`#172 <https://github.com/pytest-dev/pytest-rerunfailures/issues/172>`_)

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

12.0 (2023-07-05)
-----------------
Expand Down
20 changes: 20 additions & 0 deletions test_pytest_rerunfailures.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,26 @@ def test_rerun_except_and_only_rerun(
)


def test_rerun_except_passes_setup_errors(testdir):
testdir.makepyfile(
"""
import pytest
@pytest.fixture()
def fixture_setup_fails(non_existent_fixture):
return 1
def test_will_not_run(fixture_setup_fails):
assert fixture_setup_fails == 1"""
)

num_reruns = 1
pytest_args = ["--reruns", str(num_reruns), "--rerun-except", "ValueError"]
result = testdir.runpytest(*pytest_args)
assert result.ret != pytest.ExitCode.INTERNAL_ERROR
assert_outcomes(result, passed=0, error=1, rerun=num_reruns)


@pytest.mark.parametrize(
"condition, expected_reruns",
[
Expand Down

0 comments on commit f3ef8b3

Please sign in to comment.