Open lengau opened 2 weeks ago
Do you have a reference to what pytest.mark.usefixture
? I was only able to find the documentation for pytest.mark.usefixtures
and it's not clear to me what the difference between the two is (I never used pytest)
@pytest.mark.usefixture
is almost always a typo and should emit a pytest warning. (but technically, a plugin could register the usefixture
mark and do something with it)
Could you run pytest <path_to_file> --markers
to check if usefixture
is really a registered marker in your context?
Real-world examples:
Reference issue at the pytest repository: https://github.com/pytest-dev/pytest/issues/3972
I've seen multiple cases where a test used
pytest.mark.usefixture
rather thanpytest.mark.usefixtures
in ways that caused the tests to only sometimes fail (e.g. only on certain platforms). It would be handy to have a linter that changed this.E.g. the following code:
could be (probably with an
unsafe
marker?) converted to: