Open
Description
See #12172 (comment) for some cases where this bit us; at time of writing there are at least three cases in Pytest's own tests where this is biting us. I think it's pretty unlikely that we're the only people ever to make this mistake, so let's add a warning that would have caught it.
I propose that the warning should trigger if:
- the mark is named e.g.
skip
and a mark named e.g.skipif
also exists - for any name, not justskip
, and - the
reason
or first-positional-argument string is (1) a valid expression forast.parse
, and (2) it's not just a trivialname
expression (i.e. contains a comparison and/or a call)
Based on some quick searches, this would not have any false alarms (and so I think there would be very few after shipping), and it would catch things like pytest.mark.skip("sys.platform.startswith('win')")
.