Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ExceptionGroup ergonomics in pytest.param(..., marks=xfail(raises=...)) #12504

Closed
Closed
ExceptionGroup ergonomics in pytest.param(..., marks=xfail(raises=...))#12504
Labels
topic: parametrizerelated to @pytest.mark.parametrizetype: enhancementnew feature or API change, should be merged into features branch

Description

Suppose you have a parameterized test, some params of which are expected to raise (e.g.) IndexError:

return pytest.param(
...,
marks=pytest.mark.xfail(raises=IndexError, strict=True),
)

If your test is async though, you'll actually raise an ExceptionGroup(..., [IndexError]) (maybe with even more nesting), so the tests will still fail. Can we make this more ergonomic? What would a parametrize-aware RaisesGroup-like thing look like?

See also #11538 and #11671.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: parametrizerelated to @pytest.mark.parametrizetype: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions