Skip to content

I want a rule that will warn on non-cm use of pytest.raises #331

@jakkdl

Description

@jakkdl

Rule request

pytest-dev/pytest#13241 wants to deprecate the use of the callable form of raises, warns and deprecated_call - i.e.

excinfo = pytest.raises(ValueError, int, "hello")
# should be
with pytest.raises(ValueError) as excinfo:
  int("hello")

Rationale

The context-manager form is more readable, easier to extend, and supports additional kwargs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions