`pytest.mark.usefixtures()` without argument gets silently ignored
Someone in my pytest training accidentally did:
import pytest
@pytest.mark.usefixtures()
def test_fixt():
pass
but forgot to pass a fixture name. Because we do:
https://github.com/pytest-dev/pytest/blob/0070151c630b30e38381f1a3a00e263de4665e26/src/_pytest/fixtures.py#L1536-L1539
That results in the mark being silently ignored. IMHO, this should result in a warning or even error instead.
I think this would be a great beginner issue for someone that never contributed to pytest before. Maybe someone at the upcoming sprint wants to take a look?
We should start to warn and consider turning it into a error next major release
I am currently working on this issue, would it be better to issue a warning or raise an error?
I agree with what Ronny has said above, let's start with a warning
Hello. I would love to contribute, but I am not sure how to do so. However, my idea is that we can use the already imported warning module and warn the user whenever node.iter_markers(name="usefixtures") is empty. Hopefully someone can implement it and give it a try!
Heya, saw that #12439 has gotten a lil stale (no update since July). Alright if I take a crack at picking it up this weekend if I got time?
@daara-s sure! Please pull the original commits into your branch and add yours on top so that we'd credit that author too.