fix(tests): vault fixture removes its temp dir

This commit is contained in:
hh committed 2026-09-21 11:10:46 +00:00
1 parent 58338f132a
commit 0475e09c81
1 file changed
+7 -2
+7 -2
View File
@@ -1,4 +1,6 @@
import shutil
import tempfile
from collections.abc import Iterator
from pathlib import Path
import pytest
@@ -15,13 +17,16 @@ from beaver_agent.policy import (
@pytest.fixture
def vault() -> Path:
def vault() -> Iterator[Path]:
root = Path(tempfile.mkdtemp(prefix="beaver-vault-"))
try:
for d in ("мета/бобер", "💬 чаты", "📅 дни", "👤 люди"):
(root / d).mkdir(parents=True)
(root / "💬 чаты/старый.md").write_text("x")
(root / "📅 дни/2026-08-29.md").write_text("x")
return root
yield root
finally:
shutil.rmtree(root, ignore_errors=True)
@pytest.fixture