Skip to content

Pytest does not show inner exceptions in PEP-654 ExceptionGroups #9159

Closed
@Zac-HD

Description

@Zac-HD

Sometimes, you might have code which needs to raise multiple exceptions - for example if you retried an operation, had an error in async or cleanup code, or found multiple bugs with Hypothesis. This is pretty awkward though, and in current Pythons usually means losing some information, or at least making it less accessible.

PEP 654 adds "Exception Groups" as a standard "container" exception, to enable standardised handling of... groups of exceptions. (and except*, which Pytest can ignore)

I therefore propose that we should think about how to display a BaseExceptionGroup, with the potential tree of messages and tracebacks. This isn't urgent, since they'll be released in Python 3.11, but ideally we could support a backport sooner to enable downstream support in Hypothesis, pytest-trio, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topictopic: reportingrelated to terminal output and user-facing messages and errorstopic: tracebacksrelated to displaying and handling of tracebackstype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions