MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __init__

Method __init__

src/_pytest/cacheprovider.py:285–299  ·  view source on GitHub ↗
(self, config: Config)

Source from the content-addressed store, hash-verified

283 """Plugin which implements the --lf (run last-failing) option."""
284
285 def __init__(self, config: Config) -> None:
286 self.config = config
287 active_keys = "lf", "failedfirst"
288 self.active = any(config.getoption(key) for key in active_keys)
289 assert config.cache
290 self.lastfailed: Dict[str, bool] = config.cache.get("cache/lastfailed", {})
291 self._previously_failed_count: Optional[int] = None
292 self._report_status: Optional[str] = None
293 self._skipped_files = 0 # count skipped files during collection due to --lf
294
295 if config.getoption("lf"):
296 self._last_failed_paths = self.get_last_failed_paths()
297 config.pluginmanager.register(
298 LFPluginCollWrapper(self), "lfplugin-collwrapper"
299 )
300
301 def get_last_failed_paths(self) -> Set[Path]:
302 """Return a set with all Paths()s of the previously failed nodeids."""

Callers

nothing calls this directly

Calls 5

get_last_failed_pathsMethod · 0.95
LFPluginCollWrapperClass · 0.85
registerMethod · 0.80
getoptionMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected