-
-
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
How should we handle PEP-654 ExceptionGroup
s containing pytest XFailed
or Skipped
exceptions?
#9680
Comments
Forgive my ignorance, but I wonder if/why pytest needs to handle those at all? I think it would be good if you could elaborate a bit about Hypothesis' use case there. While |
Suppose that the user's test might call Hypothesis has just a touch of special logic for Skipped, in that (like XFailed, from Hypothesis internal's point of view, is just another exception meaning "the test failed", and any interpretation is not Hypothesis' problem. |
On considerably more reflection, and investigation how the ecosystem would look across Pytest, Hypothesis, and Unittest, I've concluded that we should not have any handling for
|
PEP-654
ExceptionGroup
has shipped in the 3.11 alphas, and there's anexceptiongroup
backport on PyPI. We already have an issue about supporting the tracebacks (#9159) and raisingExceptionGroup
from our own code (#8217).But what happens if an
ExceptionGroup
is raised from test code, and it contains a special Pytest exception? Worse, what if it contains more than one kind of special exception, i.e. the test is both skipped and xfailed? e.g.My proposal is that
XFailed
should be dropped from exception groups, since it represents a non-error case. Then, if the remainder of the exception group contains aSkipped
exception the test is skipped. Otherwise, we treat it as an ordinary failure (with a fancier traceback). Note that for efficiency reasons we might implement these checks in reverse order 😉(This is a pretty niche edge case to care about, but I just sat down to handle it in Hypothesis and quickly realized that it might depend on how the test runner handles the situation.)
The text was updated successfully, but these errors were encountered: