Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compatibility with pytest 8.2 by restoring deleted finalizers #278

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

jakkdl
Copy link
Member

@jakkdl jakkdl commented Oct 31, 2024

Fixes #267

The problem in #267 arose from pytest-dev/pytest#11833, which made pytest not add finalizers for cached fixtures.
pytest_runtest_teardown relied on cached fixtures getting their finalizers repeatedly re-added, as it deleted all(?) finalizers on every re-run. This PR makes sure to save away those finalizers, so we can add them back when we're done rerunning and let them execute.

I suspect the current solution will break with xdist or something, given that suspended_finalizers is a global dict. So it'd probably be more prudent to do something with the database?

This is my first time looking at pytest-rerunfailures, so I'd love if any current maintainers wanted to have opinions or even finish up the PR now that I've mostly figured out the messy part.

Copy link
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.

I like the change. As it fixes our tests it is definitly a step forward.

@icemac icemac merged commit 17e7b23 into pytest-dev:master Nov 5, 2024
40 checks passed
@icemac
Copy link
Contributor

icemac commented Nov 5, 2024

Thank you very much for digging into this issue.

@icemac
Copy link
Contributor

icemac commented Nov 5, 2024

Hm, this seems to have fixed the problems for 8.3, when running explicitly against 8.2 there are still failures, see https://github.com/pytest-dev/pytest-rerunfailures/actions/runs/11687465600/job/32545646408?pr=279 as an example.

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.

pytest >= 8.2 is not yet supported (not only tests fail)
2 participants