Skip to content

Fix bare exception class in only_rerun / rerun_except causing INTERNALERROR - #362

Merged
icemac merged 3 commits into
pytest-dev:masterfrom
janmrow:fix-bare-exception-rerun-filters
Sep 8, 2026
Merged

icemac merged 3 commits into
pytest-dev:masterfrom
janmrow:fix-bare-exception-rerun-filters

Conversation

@janmrow

@janmrow janmrow commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Allow only_rerun and rerun_except in @pytest.mark.flaky to accept a single exception class directly.

Before the fix passing a bare exception class name instead of a list, caused an INTERNALERROR. The value is now handled as a single filter, consistently with string arguments.

Reproduction:

@pytest.mark.flaky(reruns=2, only_rerun=ValueError)
def test_x():
    raise ValueError("ERR")

Before: INTERNALERROR: TypeError: 'type' object is not iterable.
After: 1 failed, 2 rerun.

@janmrow
janmrow marked this pull request as ready for review September 6, 2026 16:55
@janmrow

janmrow commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

The pytest-main failures here looks that are not related to scope of this PR. As far as I investigated, they are caused by the pytest NodeId change. Which is already implemented in #363.

@icemac
icemac enabled auto-merge (squash) September 8, 2026 06:45
@icemac

icemac commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Thank you for this PR. 😃

@icemac
icemac merged commit 402afb4 into pytest-dev:master Sep 8, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants