Open webknjaz opened 9 months ago
Hi @webknjaz ,
I would argue that names prefixed with an underscore are designed to be unused, and to avoid clashing with builtin names I personally would suffix the name with the underscore instead of prefixing (i.e. set_
instead of _set
). I understand this is opinionated, but it is consistent with rules PT004
and PT005
which check for leading underscores in fixture names.
Maybe, but it's still a bug. The error is lying to my face implying that it doesn't work in runtime.
I agree that the error message is misleading in this case.
In simple cases we can analyse the names configured in parametrize
and avoid triggering PT019
for them. I'm not sure when I can get around to it myself, but I would gladly accept a PR.
Bug report
What's wrong
I get
with
How it should work
PT019 shouldn't be triggered. Replacing
_set
withx_set
works, so the plugin incorrectly assumes that there's no value provided for_set
while it is, and incorrectly suggests using@pytest.mark.usefixtures
, which would make it impossible to provide it with a value.System information
flake8-pytest-style ~= 1.7.2