Skip to content

fix: accept exception classes in only_rerun and rerun_except markers#327

Merged
icemac merged 1 commit into
pytest-dev:masterfrom
SAY-5:fix-rerun-filter-exception-classes
May 13, 2026
Merged

fix: accept exception classes in only_rerun and rerun_except markers#327
icemac merged 1 commit into
pytest-dev:masterfrom
SAY-5:fix-rerun-filter-exception-classes

Conversation

@SAY-5
Copy link
Copy Markdown
Contributor

@SAY-5 SAY-5 commented May 12, 2026

Passing an exception class (rather than a regex string) to the only_rerun or rerun_except keyword of @pytest.mark.flaky caused re.search to raise and crash pytest with an internal error. Exception classes are now matched via issubclass against the raised exception type. Closes #275.

Copy link
Copy Markdown
Contributor

@icemac icemac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@icemac icemac merged commit 5e0ad6a into pytest-dev:master May 13, 2026
42 checks passed
@icemac
Copy link
Copy Markdown
Contributor

icemac commented May 13, 2026

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.

Crash when only_rerun is given an actual Exception type

2 participants