Open agronholm opened 2 years ago
As of 1.0.0rc9, other projects can now be made to support exception group formatting via this library.
Is pytest such a library?
I believe there are people already working to integrate exception groups to pytest.
The hypothesis project had a number of PRs concerning the topic.
The tip:
For now, you can use pytest's
--tb=native
flag to see the tracebacks for each sub-exception.
looks to be very useful for now. Ideally PyTest will start displaying exception groups and notes natively at some point.
Linking all the ecosystem issues and status I know of, so they're visible in one place:
exceptiongroup
until Python 3.10 reaches end of life in October 2026.@agronholm are you okay with adding/moving the apport excepthook we currently have in Trio
over to exceptiongroup? I can report a bug and open PR in apport for adding exceptiongroup support, but as Zac above says exceptiongroup would also need to carry a workaround due to Ubuntu being very conservative in package versions and new apport releases would take approximately forever to trickle down to all end users.
I'm okay with it as a workaround, so long as it doesn't affect anything else.
Apport looks like we'd report a bug to https://bugs.launchpad.net/apport and open a PR at https://github.com/canonical/apport; see https://github.com/python-trio/trio/issues/2464 for links to Trio's current workaround
As of #88 there is now a workaround for apport, but I also opened https://bugs.launchpad.net/apport/+bug/2042672
As requested on https://github.com/python-trio/trio/pull/2213, we should try to add exceptiongroup support to both IPython and Apport. This issue tracks all efforts to add exceptiongroup support to other projects.
IPython seems to use customized versions of
format_exception()
andformat_exception_only()
, so it's likely to need an update to display exception groups, even on Python 3.11.Apport, on the other hand, uses
format_exc()
andprint_exc()
straight from thetraceback
module, so a conditional import might do the trick.