last_failed_paths: improve caching
This commit is contained in:
parent
ceb4f3f701
commit
480dd9e6d6
|
@ -164,13 +164,14 @@ class LFPlugin(object):
|
||||||
def last_failed_paths(self):
|
def last_failed_paths(self):
|
||||||
"""Returns a set with all Paths()s of the previously failed nodeids (cached).
|
"""Returns a set with all Paths()s of the previously failed nodeids (cached).
|
||||||
"""
|
"""
|
||||||
result = getattr(self, "_last_failed_paths", None)
|
try:
|
||||||
if result is None:
|
return self._last_failed_paths
|
||||||
|
except AttributeError:
|
||||||
rootpath = Path(self.config.rootdir)
|
rootpath = Path(self.config.rootdir)
|
||||||
result = {rootpath / nodeid.split("::")[0] for nodeid in self.lastfailed}
|
result = {rootpath / nodeid.split("::")[0] for nodeid in self.lastfailed}
|
||||||
result = {x for x in result if x.exists()}
|
result = {x for x in result if x.exists()}
|
||||||
self._last_failed_paths = result
|
self._last_failed_paths = result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def pytest_ignore_collect(self, path):
|
def pytest_ignore_collect(self, path):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue