Skip to content

Design discussion: how should we test for expected ExceptionGroups? #10441

@Zac-HD

Description

@Zac-HD

Python 3.11 has been released with the new ExceptionGroup type, and there's a great backport too.

As people start to write code which can raise ExceptionGroups, there's also going to be a corresponding need to test that they raised the expected group of exceptions, and that's where this issue comes in: our existing APIs aren't particularly helpful for this. For example, in the PR to use ExceptionGroups for Pytest teardown errors, I used with pytest.raises(...) to catch the group, but then had to manually unpack the structure and do isinstance() checks by hand.

I'd like to take our time and find the right API, rather than hurrying to any particular conclusion, and that should be based on a volume and diversity of experience that just doesn't exist yet. This issue therefore exists to collect use-cases, design ideas, and discussion, until we're confident that we can ship the right thing for the next decade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: help wanteddevelopers would like help from experts on this topic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions