-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
topic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch
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')")
.
Pierre-Sassoulas and ferdnyc
Metadata
Metadata
Assignees
Labels
topic: marksrelated to marks, either the general marks or builtinrelated to marks, either the general marks or builtintype: enhancementnew feature or API change, should be merged into features branchnew feature or API change, should be merged into features branch