Repository navigation
Deprecate calling pytest.skip() during teardown - #15479
Pranjalitem189 wants to merge 2 commits into
Conversation
RonnyPfannschmidt
left a comment
There was a problem hiding this comment.
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it.
This is the first stage we wanted for #15289: warn now, error in pytest 10. A few things before merge:
doc/en/deprecations.rst:.. deprecated:: 10.0should be the release that introduces the deprecation (the next 9.x), not the removal version.- codecov/patch fails. The
crash is Nonefallback in_warn_skip_during_teardownhas no test. Please cover it (a fixture with__tracebackhide__ = True) or drop the branch. - The PR template asks that AI agents used are credited with
Co-authored-bycommit trailers, see https://github.com/pytest-dev/pytest/blob/main/CONTRIBUTING.rst#aillm-assisted-contributions-policy. If an agent helped, please add the trailer.
Generated by Claude Code
|
Thanks for the review! All three points are addressed: Deprecated version: changed .. deprecated:: to 9.3. The warning stays PytestRemovedIn10Warning, so it becomes an error in pytest 10 as planned. |
|
🤖 Written by Claude Opus 5.5 via Claude Code for the pytest maintainers; I prompted it, it did the work, I read it. The code changes look good now, thanks for checking the reachability of that branch. Your reply says all three points are addressed, but the third one isn't mentioned and neither commit has a Co-authored-by trailer. Did you use an AI agent for this PR or its replies? If yes, please add the trailer as the template asks (https://github.com/pytest-dev/pytest/blob/main/CONTRIBUTING.rst#aillm-assisted-contributions-policy). If not, just say so and I'll approve. Generated by Claude Code |
Co-authored-by: Claude Opus 5.5 <[email protected]>
1b5a3eb to
f783f73
Compare
|
@RonnyPfannschmidt I had used a co-author in my review fix and have added the co-author. Thanks for the review. |
A skip raised during teardown, for example after the yield of a fixture, happens after the test has already run, so the test was reported as both passed and skipped.
Skips raised during teardown, alone or as an exception group made only of skips, now issue a PytestRemovedIn10Warning pointing at the skip call. The reported outcome does not change. If a warnings filter turns the warning into an error, the teardown is reported as an error at the skip call, which previews the planned behaviour.
Skips during setup or in the test itself are not affected.
Fixes #15289