MCPcopy
hub / github.com/pytest-dev/pytest / test_access_denied_during_cleanup

Function test_access_denied_during_cleanup

testing/test_pathlib.py:458–470  ·  view source on GitHub ↗

Ensure that deleting a numbered dir does not fail because of OSErrors (#4262).

(tmp_path: Path, monkeypatch: MonkeyPatch)

Source from the content-addressed store, hash-verified

456
457
458def test_access_denied_during_cleanup(tmp_path: Path, monkeypatch: MonkeyPatch) -> None:
459 """Ensure that deleting a numbered dir does not fail because of OSErrors (#4262)."""
460 path = tmp_path / "temp-1"
461 path.mkdir()
462
463 def renamed_failed(*args):
464 raise OSError("access denied")
465
466 monkeypatch.setattr(Path, "rename", renamed_failed)
467
468 lock_path = get_lock_path(path)
469 maybe_delete_a_numbered_dir(path)
470 assert not lock_path.is_file()
471
472
473def test_long_path_during_cleanup(tmp_path: Path) -> None:

Callers

nothing calls this directly

Calls 4

get_lock_pathFunction · 0.90
setattrMethod · 0.80
mkdirMethod · 0.45

Tested by

no test coverage detected