Skip to content

Fix support for pytest-main.#324

Open
icemac wants to merge 2 commits intomasterfrom
fix-323
Open

Fix support for pytest-main.#324
icemac wants to merge 2 commits intomasterfrom
fix-323

Conversation

@icemac
Copy link
Copy Markdown
Contributor

@icemac icemac commented Apr 10, 2026

Fixes #323

@icemac icemac self-assigned this Apr 10, 2026
@icemac icemac requested a review from Copilot April 10, 2026 06:41
@icemac icemac requested a review from sallner April 10, 2026 06:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes compatibility with pytest mainline (and pytest >= 9) by ensuring rerunfailures properly resets fixture execution state when a fixture setup fails and is retried, preventing pytest’s internal assertion about leftover fixture finalizers.

Changes:

  • Clear FixtureDef._finalizers when removing cached results for failed fixtures so reruns can re-execute fixtures cleanly.
  • Document the compatibility fix in CHANGES.rst.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/pytest_rerunfailures.py Clears fixture finalizers during failed-fixture cache cleanup to avoid pytest >= 9 assertion failures on rerun.
CHANGES.rst Adds an unreleased changelog entry describing the compatibility fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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.

Tests are broken against pytest-main

2 participants