Skip to content

PT016 recommends deprecated kwarg. #3387

@tobiasraabe

Description

@tobiasraabe
  • ruff version: 0.0.254

Hi!

Thanks for the amazing application!

Rule PT016 suggests adding a reason when using pytest.fail(), but when using a keyword argument it requires the deprecated msg keyword instead of the new reason kwarg introduced in v7 (https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest.fail).

pytest.fail("reason")  # OK
pytest.fail(msg="reason")  # OK
pytest.fail(reason="reason")  # Error PT016

The current behavior is the same as flake8-pytest-style (https://github.com/m-burst/flake8-pytest-style/blob/master/docs/rules/PT016.md), but I do not see a reason to stay with deprecated behavior.

Cheers!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions