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.
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
first draft of handling marker exceptions wrapped in exceptiongroup #4110
base: master
Are you sure you want to change the base?
first draft of handling marker exceptions wrapped in exceptiongroup #4110
Changes from 1 commit
38c5208
057303a
dca18e4
14be202
1d73c19
4e06b62
e7e09bd
51a6f75
b27520f
d3fd6d2
3144ddd
2a9f54d
d387e20
2542ca4
09f4151
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Yep, the semantics here (generally) are a good question.
I'd opine:
Frozen
, raise the first (as above).Frozen
,raise
that one [*]..with_traceback(eg.__traceback__)
).[*] hm, I see, that would cause an undesired unwrapping if user code raises a single-exception
ExceptionGroup
. Maybe the second step should be "if exactly one ... and that exception is aStopException
orHypothesisException
.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.
Actually, I think this could cause confusion. If I spawn three tasks and I only get oneFrozen
, I will assume that the-thing-that-caused-Frozen only happened in one of the tasks. We should probably err on the side of not unwrapping unless necessary to get internal exception handling to work.edit: nvm, I thought frozen didn't get swallowed by
@given
edit2: I'm confused about how hypothesis works 😅
edit3: Aaaahhh.
hypothesis/hypothesis-python/src/hypothesis/core.py
Lines 1077 to 1089 in 4d079f7
This means that if we got our data frozen, any exceptions (no matter if inside a group or not) get disregarded. So it doesn't matter what we do if there's only frozen exceptions
edit4: and this is very bad, because it can suppress
TypeError
and anything. Gotta rejig some logic hereedit5: except that's what the code currently does in sync code, so... ?
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.
Another question is if we get multiple
HypothesisException
/StopException
, if that's possible?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.
If we get multiple
StopTest
, re-raise the one with the lowest _testcounter i.e. the first one to occur.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'd just catch
BaseExceptionGroup
(viahypothesis.internal.compat.BaseExceptionGroup
) and check the subexceptions explicitly, to avoid thetrio
dependency.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.
ye that's probably the way to go. I'm incredibly biased on the matter as the person who wrote
trio.testing.RaisesGroup
and is trying to get it added to pytest 😇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.
(and as a dual maintainer of Pytest and Trio, among other things, I'm pretty keen to support that when I have time 😅)