File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 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:
118118 return False
119119
120120
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+
121140def pytest_collection_modifyitems (config , items ):
122141 # 1. Prepare for iterating over items
123142 # -----------------------------------
@@ -165,13 +184,13 @@ def pytest_collection_modifyitems(config, items):
165184 markers = list (item .iter_markers ())
166185 # skip if specified in skips file
167186 for id_ in skip_ids :
168- if id_ in item .nodeid :
187+ if check_id_match ( item .nodeid , id_ ) :
169188 item .add_marker (mark .skip (reason = f"--skips-file ({ skips_file } )" ))
170189 skip_id_matched [id_ ] = True
171190 break
172191 # xfail if specified in xfails file
173192 for id_ in xfail_ids :
174- if id_ in item .nodeid :
193+ if check_id_match ( item .nodeid , id_ ) :
175194 item .add_marker (mark .xfail (reason = f"--xfails-file ({ xfails_file } )" ))
176195 xfail_id_matched [id_ ] = True
177196 break
You can’t perform that action at this time.
0 commit comments