pytest-dev / pytest-rerunfailures

a pytest plugin that re-runs failed tests up to -n times to eliminate flakey failures
Other
380 stars 83 forks source link

Fix Missing Fixture Teardown operations #260

Closed HarryKrause closed 7 months ago

HarryKrause commented 7 months ago

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 commented 7 months ago

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?

HarryKrause commented 7 months ago

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