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

Function test_access_denied_during_cleanup

testing/test_pathlib.py:339–351  ·  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

337
338
339def test_access_denied_during_cleanup(tmp_path: Path, monkeypatch: MonkeyPatch) -> None:
340 """Ensure that deleting a numbered dir does not fail because of OSErrors (#4262)."""
341 path = tmp_path / "temp-1"
342 path.mkdir()
343
344 def renamed_failed(*args):
345 raise OSError("access denied")
346
347 monkeypatch.setattr(Path, "rename", renamed_failed)
348
349 lock_path = get_lock_path(path)
350 maybe_delete_a_numbered_dir(path)
351 assert not lock_path.is_file()
352
353
354def 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