Skip to content

[PT011] Support pytest 8.4.0 check parameter #22673

@harupy

Description

@harupy

Summary

[PT011] Support pytest 8.4.0 check parameter

Description

PT011 (pytest-raises-too-broad) should not trigger when check is provided, as it narrows exception matching like match does.

# Currently triggers PT011 (false positive)
with pytest.raises(OSError, check=lambda e: e.errno == errno.EACCES):
    ...

PT010 already handles this correctly.

References: https://github.com/pytest-dev/pytest/releases/tag/8.4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions