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

Function cleanup_candidates

src/_pytest/pathlib.py:326–335  ·  view source on GitHub ↗

List candidates for numbered directories to be removed - follows py.path.

(root: Path, prefix: str, keep: int)

Source from the content-addressed store, hash-verified

324
325
326def cleanup_candidates(root: Path, prefix: str, keep: int) -> Iterator[Path]:
327 """List candidates for numbered directories to be removed - follows py.path."""
328 max_existing = max(map(parse_num, find_suffixes(root, prefix)), default=-1)
329 max_delete = max_existing - keep
330 paths = find_prefixed(root, prefix)
331 paths, paths2 = itertools.tee(paths)
332 numbers = map(parse_num, extract_suffixes(paths2, prefix))
333 for path, number in zip(paths, numbers):
334 if number <= max_delete:
335 yield path
336
337
338def cleanup_numbered_dir(

Callers 1

cleanup_numbered_dirFunction · 0.85

Calls 3

find_suffixesFunction · 0.85
find_prefixedFunction · 0.85
extract_suffixesFunction · 0.85

Tested by

no test coverage detected