ruff
ruff copied to clipboard
Rule PT019 Treats Unused Mocks as Fixtures when prefixed with underscores
Rule PT019 flags unused mock arguments prefixed with underscores as Pytest fixtures.
Example
from unittest import mock
# `_func` gets treated as unused fixture, failing a `ruff check`.
@mock.patch("func")
def test(_func):
assert 1 == 1
Details
- Ruff version: v0.0.286
- Command:
ruff check .
@charliermarsh Understand this is probably just due to fixture naming conventions, but just thought I would flag in case!
There is a similar issue in the upstream: https://github.com/m-burst/flake8-pytest-style/issues/202