Skip to content

Fix Missing Fixture Teardown operations#260

Merged
icemac merged 1 commit intopytest-dev:masterfrom
HarryKrause:fix_session_teardown_bugs
Feb 29, 2024
Merged

Fix Missing Fixture Teardown operations#260
icemac merged 1 commit intopytest-dev:masterfrom
HarryKrause:fix_session_teardown_bugs

Conversation

@HarryKrause
Copy link
Copy Markdown
Contributor

@HarryKrause HarryKrause commented Feb 22, 2024

When using the only_rerun and rerun_except queries (or both), the plug-in was removing the teardown operations from the call-stack before checking to see if the test should be re-run. This resulted in the stack having all fixture operations removed that did not correspond to a function fixture.

This commit adds a private variable to each test item that keeps track of whether a test encountered a terminal error. The plugin now checks if a test has encountered a terminal error before attempting to clear the stack.

@icemac
Copy link
Copy Markdown
Contributor

icemac commented Feb 23, 2024

Thank you for your PR. Due to other PRs the files you changed have been moved around on the master branch. Could you please rebase your changes onto the current master branch?

When using the only_rerun and rerun_except queries (or both), the
plug-in was removing the teardown operations from the call-stack before
checking to see if the test should be re-run. This resulted in the
stack having all fixture operations removed that did not correspond
to a function fixture.

This commit adds a private variable to each test item that keeps
track of whether a test encountered a terminal error. The plugin now
checks if a test has encountered a terminal error before attempting
to clear the stack.

This commit fixes:
- pytest-dev#241
- pytest-dev#234
@HarryKrause HarryKrause force-pushed the fix_session_teardown_bugs branch from e6c43c5 to 6727700 Compare February 23, 2024 14:43
@HarryKrause
Copy link
Copy Markdown
Contributor Author

@icemac Rebased! Let me know if you require any other updates.

@icemac icemac requested a review from hugovk February 28, 2024 07:44
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 from reading through the code.

@hugovk hugovk removed their request for review February 28, 2024 09:22
@icemac icemac merged commit 0ab54f0 into pytest-dev:master Feb 29, 2024
The-Compiler added a commit that referenced this pull request Mar 29, 2025
hugovk pushed a commit that referenced this pull request Aug 27, 2025
icemac added a commit that referenced this pull request Aug 27, 2025
See #260 and #290.

Co-authored-by: Michael Howitz <icemac@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants