Skip to content

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

Open
janmrow wants to merge 2 commits into
pytest-dev:masterfrom
janmrow:fix-bare-exception-rerun-filters
Open

Fix bare exception class in only_rerun / rerun_except causing INTERNALERROR#362
janmrow wants to merge 2 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.

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.

1 participant