fix(tests): vault fixture removes its temp dir
This commit is contained in:
1 parent
58338f132a
commit
0475e09c81
1 file changed
+11
-6
+11
-6
@@ -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-"))
|
||||
for d in ("мета/бобер", "💬 чаты", "📅 дни", "👤 люди"):
|
||||
(root / d).mkdir(parents=True)
|
||||
(root / "💬 чаты/старый.md").write_text("x")
|
||||
(root / "📅 дни/2026-08-29.md").write_text("x")
|
||||
return root
|
||||
try:
|
||||
for d in ("мета/бобер", "💬 чаты", "📅 дни", "👤 люди"):
|
||||
(root / d).mkdir(parents=True)
|
||||
(root / "💬 чаты/старый.md").write_text("x")
|
||||
(root / "📅 дни/2026-08-29.md").write_text("x")
|
||||
yield root
|
||||
finally:
|
||||
shutil.rmtree(root, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
Reference in new issue
Block a user