File tree 1 file changed +21
-2
lines changed
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,25 @@ def xp_has_ext(ext: str) -> bool:
118
118
return False
119
119
120
120
121
+ def check_id_match (id_ , pattern ):
122
+ if id_ == pattern :
123
+ return True
124
+
125
+ if id_ .startswith (pattern .removesuffix ("/" ) + "/" ):
126
+ return True
127
+
128
+ if pattern .endswith (".py" ) and id_ .startswith (pattern ):
129
+ return True
130
+
131
+ if id_ .split ("::" , maxsplit = 2 )[0 ] == pattern :
132
+ return True
133
+
134
+ if id_ .split ("[" , maxsplit = 2 )[0 ] == pattern :
135
+ return True
136
+
137
+ return False
138
+
139
+
121
140
def pytest_collection_modifyitems (config , items ):
122
141
# 1. Prepare for iterating over items
123
142
# -----------------------------------
@@ -165,13 +184,13 @@ def pytest_collection_modifyitems(config, items):
165
184
markers = list (item .iter_markers ())
166
185
# skip if specified in skips file
167
186
for id_ in skip_ids :
168
- if id_ in item .nodeid :
187
+ if check_id_match ( item .nodeid , id_ ) :
169
188
item .add_marker (mark .skip (reason = f"--skips-file ({ skips_file } )" ))
170
189
skip_id_matched [id_ ] = True
171
190
break
172
191
# xfail if specified in xfails file
173
192
for id_ in xfail_ids :
174
- if id_ in item .nodeid :
193
+ if check_id_match ( item .nodeid , id_ ) :
175
194
item .add_marker (mark .xfail (reason = f"--xfails-file ({ xfails_file } )" ))
176
195
xfail_id_matched [id_ ] = True
177
196
break
You can’t perform that action at this time.
0 commit comments