Skip to content

Commit

Permalink
last_failed_paths: improve caching
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed May 29, 2019
1 parent ceb4f3f commit 480dd9e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/_pytest/cacheprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,14 @@ def __init__(self, config):
def last_failed_paths(self):
"""Returns a set with all Paths()s of the previously failed nodeids (cached).
"""
result = getattr(self, "_last_failed_paths", None)
if result is None:
try:
return self._last_failed_paths
except AttributeError:
rootpath = Path(self.config.rootdir)
result = {rootpath / nodeid.split("::")[0] for nodeid in self.lastfailed}
result = {x for x in result if x.exists()}
self._last_failed_paths = result
return result
return result

def pytest_ignore_collect(self, path):
"""
Expand Down

0 comments on commit 480dd9e

Please sign in to comment.