step 8: harden docs and prepare rebuilt beta

This commit is contained in:
2026-05-23 10:47:34 +02:00
parent d0ba8c4218
commit 50e38e18ee
17 changed files with 653 additions and 65 deletions

View File

@@ -7,6 +7,8 @@ from dpg_map.cache import (
DiskCacheConfig,
DiskCacheMetadata,
MemoryCacheConfig,
clear_disk_cache_path,
disk_cache_size_bytes,
plan_disk_prune,
tile_cache_path,
write_disk_metadata,
@@ -66,3 +68,23 @@ def test_disk_cache_prune_ordering(tmp_path: Path) -> None:
planned = plan_disk_prune(tmp_path, 5, protected_paths={protected})
assert planned == [first, second]
def test_provider_scoped_disk_cache_clear(tmp_path: Path) -> None:
osm = tile_cache_path(tmp_path, "osm", 1, 1, 1)
custom = tile_cache_path(tmp_path, "custom", 1, 1, 1)
for path in (osm, custom):
path.parent.mkdir(parents=True, exist_ok=True)
path.write_bytes(b"abcde")
write_disk_metadata(
path.with_suffix(".json"),
DiskCacheMetadata(url=str(path), last_accessed_at=1.0, size_bytes=5),
)
assert disk_cache_size_bytes(tmp_path, provider="osm") == 5
clear_disk_cache_path(tmp_path, provider="osm")
assert not osm.exists()
assert custom.exists()
assert disk_cache_size_bytes(tmp_path) == 5