Count model directory contents against the cache quota
This commit is contained in:
parent
6c4b33a418
commit
fb31b3ed83
1 changed files with 17 additions and 1 deletions
|
|
@ -45,3 +45,14 @@ def test_cached_directories_can_be_removed(
|
|||
monkeypatch.setattr(LargeFileLocal, "max_cache_size", "0")
|
||||
reader.clean_up()
|
||||
assert not cached.exists()
|
||||
|
||||
|
||||
def test_cache_quota_counts_directory_contents(
|
||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
||||
) -> None:
|
||||
source = tmp_path / "source"
|
||||
source.mkdir()
|
||||
(source / "weights").write_bytes(b"x" * 100_000)
|
||||
monkeypatch.setattr(LargeFileLocal, "max_cache_size", "1 KB")
|
||||
LargeFileLocal("model", "w").push(source)
|
||||
assert not (LargeFileLocal.cache_path / "model-0").exists()
|
||||
|
|
|
|||
Loading…
Reference in a new issue