-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Restore skipping tests via raise unittest.SkipTest
#13912
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
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
| excinfo = call.excinfo | ||
| call2 = CallInfo[None].from_call(lambda: skip(str(excinfo.value)), call.when) | ||
| call.excinfo = call2.excinfo |
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.
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
| skip_exceptions = [Skipped] | |
| unittest = sys.modules.get("unittest") | |
| if unittest is not None: | |
| skip_exceptions.append(unittest.SkipTest) |
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 |
|
For the record, this also fixes use of from unittest import skipIf
@skipIf(True, "skipping")
def test_foo():
pass…which is something |
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? |
Revert "Remove unused code related to
nose(#13528)"This reverts commit a620d24 and modifies it adding tests and docs.
Fixes #13895