You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In such cases I think it's pretty clear that we should treat an exception group containing a StopTest as we would a StopTest itself. I think it's also pretty clear that any Frozen exceptions inside an ExceptionGroup are causally downstream of some other exception, and can therefore be discarded so long as there's any other exception in the group too.
The text was updated successfully, but these errors were encountered:
Zac-HD
added
bug
something is clearly wrong here
interop
how to play nicely with other packages
internals
Stuff that only Hypothesis devs should ever see
labels
Sep 15, 2024
How picky are you about depending on exceptiongroup for newer python versions?
3.12.1 added ExceptionGroup support for contextlib.suppress, so if we wanna use exceptiongroup.suppress we need to bump the install_requirement to python < 3.12.1.
I count 9 instances of suppress usage.
Needs to have their exception handlers split out into separate functions. We're then left with the choice of using exceptiongroup.catch on all python versions to invoke them, or rolling our own handler in an except ExceptionGroup.
I don't think rolling our own is super ugly/complicated in either case, so am open to both options.
I suggest it may be simplest to unwrap/discard the exceptiongroup around actual test execution, similar in effect to adding it to the end of ensure_free_stackframes.__exit__ but in a new context manager. Then, everything outside - including the suppress calls - is unaffected.
(i.e., with unwrap_exceptions(), ensure_free_stackframes(): return self.test(...))
[ed: To be clear, the context manager would discard Frozen subexceptions, and if there's exactly one remaining subexception then raise that instead of the group]
Hypothesis currently misbehaves if the marker exceptions we raise are wrapped up in an
ExceptionGroup
, e.g.:In such cases I think it's pretty clear that we should treat an exception group containing a
StopTest
as we would aStopTest
itself. I think it's also pretty clear that anyFrozen
exceptions inside anExceptionGroup
are causally downstream of some other exception, and can therefore be discarded so long as there's any other exception in the group too.The text was updated successfully, but these errors were encountered: