File tree 1 file changed +8
-11
lines changed
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ def last_failed_paths(self):
168
168
if result is None :
169
169
rootpath = Path (self .config .rootdir )
170
170
result = {rootpath / nodeid .split ("::" )[0 ] for nodeid in self .lastfailed }
171
+ result = {x for x in result if x .exists ()}
171
172
self ._last_failed_paths = result
172
173
return result
173
174
@@ -176,17 +177,13 @@ def pytest_ignore_collect(self, path):
176
177
Ignore this file path if we are in --lf mode and it is not in the list of
177
178
previously failed files.
178
179
"""
179
- if (
180
- self .active
181
- and self ._previously_failed_count
182
- and self .config .getoption ("lf" )
183
- and path .isfile ()
184
- and self .lastfailed
185
- ):
186
- skip_it = Path (path ) not in self .last_failed_paths ()
187
- if skip_it :
188
- self ._skipped_files += 1
189
- return skip_it
180
+ if self .active and self .config .getoption ("lf" ) and path .isfile ():
181
+ last_failed_paths = self .last_failed_paths ()
182
+ if last_failed_paths :
183
+ skip_it = Path (path ) not in self .last_failed_paths ()
184
+ if skip_it :
185
+ self ._skipped_files += 1
186
+ return skip_it
190
187
191
188
def pytest_report_collectionfinish (self ):
192
189
if self .active and self .config .getoption ("verbose" ) >= 0 :
You can’t perform that action at this time.
0 commit comments