-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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 teardown error reporting when --maxfail=1
#11721
Merged
bluetech
merged 7 commits into
pytest-dev:main
from
bbrown1867:bbrown/11706/fix-teardown-reporting
Jan 3, 2024
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7176470
Correctly report teardown fixture errors
bbrown1867 f90dc39
PR feedback: Move changing of nextitem to runtestprotocol and also ch…
bbrown1867 b81532e
PR feedback: Improve new unit test
bbrown1867 c1adee0
Add new unit test for new shouldstop scenario
bbrown1867 75e9f3b
PR feedback: Make shouldfail and shouldstop properties, prevent True …
bbrown1867 6bb20d9
PR feedback: Raise warnings in the new properties for shouldstop and …
bbrown1867 b559724
Some tweaks
bluetech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix reporting of teardown errors in higher-scoped fixtures when using `--maxfail` or `--stepwise`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bluetech should an exception be raised here? Or is simply ignoring the operation okay?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think silently ignoring is no good, it will be confusing why there is no effect.
The two options are issuing a warning, or raising an exception. Since we're already stopping raising an exception seems kinda pointless, so I think we should go with a warning. I think it can be something like this:
Unfortunately it does mean you'll need to write extra tests to cover these warnings, let me know if you need help with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay sounds good, I've added the warnings and and a unit test for the
shouldfail
scenario calledtest_shouldfail_is_sticky
. I'm usingpytest_sessionfinish
to trigger the bad behavior. However this same approach did not work forshouldstop
- it seems likeshouldstop
was stillFalse
inpytest_sessionfinish
even if I changedpytest.fail
topytest.exit
. Any ideas on how to test theshouldstop
scenario?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing which sets
shouldstop
in pytest core is--stepwise
, which actually has the same problem as--maxfail
. Since I've already checked out the branch, I've pushed the new test along with some tweaks. This is now good to go, thanks!