feat(v2): complete v2 reimplementation
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from backup_tool.gc import purge_repository
|
||||
|
||||
|
||||
def test_gc_keeps_manifest_when_unlink_fails(tmp_path: Path) -> None:
|
||||
root = tmp_path / "repository"
|
||||
manifest = root / "manifests" / "deleted.json"
|
||||
manifest.parent.mkdir(parents=True)
|
||||
manifest.write_text('{"entries": []}', encoding="utf-8")
|
||||
|
||||
with (
|
||||
patch("pathlib.Path.unlink", side_effect=OSError("read-only")),
|
||||
pytest.raises(OSError),
|
||||
):
|
||||
purge_repository(root, {"deleted"}, grace=timedelta(0))
|
||||
|
||||
assert manifest.exists()
|
||||
Reference in New Issue
Block a user