Restore skipping tests via raise unittest.SkipTest#13912
Merged
nicoddemus merged 1 commit intopytest-dev:mainfrom Nov 10, 2025
Merged
Restore skipping tests via raise unittest.SkipTest#13912nicoddemus merged 1 commit intopytest-dev:mainfrom
raise unittest.SkipTest#13912nicoddemus merged 1 commit intopytest-dev:mainfrom
Conversation
3be84b3 to
9609029
Compare
Revert "Remove unused code related to `nose` (pytest-dev#13528)" This reverts commit a620d24 and modifies it adding tests and docs. Fixes pytest-dev#13895
9609029 to
2ef26ee
Compare
bluetech
approved these changes
Nov 10, 2025
Comment on lines
+483
to
+485
| excinfo = call.excinfo | ||
| call2 = CallInfo[None].from_call(lambda: skip(str(excinfo.value)), call.when) | ||
| call.excinfo = call2.excinfo |
Member
There was a problem hiding this comment.
This code is quite hacky, I do wonder why the code in the runner doesn't do the trick:
Lines 407 to 410 in 1ff8c9b
In any case we can analyze it later, for 9.0 reverting seems best.
Backport to 9.0.x: 💚 backport PR created✅ Backport PR branch: Backported as #13916 🤖 @patchback |
nicoddemus
added a commit
that referenced
this pull request
Nov 10, 2025
Contributor
|
For the record, this also fixes use of from unittest import skipIf
@skipIf(True, "skipping")
def test_foo():
pass…which is something |
gentoo-bot
pushed a commit
to gentoo/gentoo
that referenced
this pull request
Nov 11, 2025
Backport an upstream fix for handling SkipTest exceptions raised outside unittest.TestCase, which also happens to fix unittest.skipIf() on top-level test functions (needed for dev-python/botocore). Bug: pytest-dev/pytest#13895 Pull-Request: pytest-dev/pytest#13912 Signed-off-by: Michał Górny <mgorny@gentoo.org>
|
Ran into this issue in my code base, too. When will this fix be released as pytest 9.0.1? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Revert "Remove unused code related to
nose(#13528)"This reverts commit a620d24 and modifies it adding tests and docs.
Fixes #13895