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