File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 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):
168168 if result is None :
169169 rootpath = Path (self .config .rootdir )
170170 result = {rootpath / nodeid .split ("::" )[0 ] for nodeid in self .lastfailed }
171+ result = {x for x in result if x .exists ()}
171172 self ._last_failed_paths = result
172173 return result
173174
@@ -176,17 +177,13 @@ def pytest_ignore_collect(self, path):
176177 Ignore this file path if we are in --lf mode and it is not in the list of
177178 previously failed files.
178179 """
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
190187
191188 def pytest_report_collectionfinish (self ):
192189 if self .active and self .config .getoption ("verbose" ) >= 0 :
You can’t perform that action at this time.
0 commit comments