Ensure that deleting a numbered dir does not fail because of OSErrors (#4262).
(tmp_path: Path, monkeypatch: MonkeyPatch)
| 456 | |
| 457 | |
| 458 | def 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 | |
| 473 | def test_long_path_during_cleanup(tmp_path: Path) -> None: |
nothing calls this directly
no test coverage detected