Open MarcoGorelli opened 2 years ago
I don't follow. This seems to be a test which uses a fixture, in exactly the way how fixtures are intended to be used? :thinking:
sorry, I'd accidentally removed the part the test which was the issue to test that it was picking up the fixture 🤦
have updated the issue description now, hope it's clear. the argument in pytest.mark.parametrize
is the same one that's in the fixture
Ah, that makes more sense now. Seems reasonable to me to show a warning in this case, but note there's indirect fixture parametrization which still needs to work, and looks almost like this.
Thanks @The-Compiler
So, in cases when indirect
isn't equal to True
, then it should be safe to warn?
It seems to me that it should, yes. But there are certainly a lot of subtleties involved in how fixtures work. Maybe someone else could confirm this?
What's the problem this feature will solve?
Say I have the files:
Describe the solution you'd like
Some warning that, in
test_me
, I have an argument whose name shadows that of a fixtureThis came out of a PR in pandas https://github.com/pandas-dev/pandas/pull/49754#discussion_r1025656945
Alternative Solutions
I'm tempted to write my own tool to do this, just wanted to check it's not been done already. I tried searching "argument shadows fixture " and similar things in the issue tracker but didn't find anything.
Additional context