Skip to content

Commit 63c27d0

Browse files
nickrociclaude
andcommitted
test(daemon): isolate AGENT_MEM_HOME in the daemon.state test
The test wrote to the real ~/.agent-mem (CI has no such dir -> FileNotFoundError; locally it silently clobbered the user's daemon.state). conftest's home isolation is opt-in (agent_mem_home), not autouse as a stale docstring implied, so request it explicitly and assert against the isolated tmp. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1d53ef8 commit 63c27d0

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

daemon/tests/test_daemon_state.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
"""The daemon stamps the version of the code it is running into daemon.state, so
22
the `ultan` spawn path can detect a daemon left on old code after an update and
3-
restart it. (Home is isolated by the autouse fixture in conftest.)"""
3+
restart it. ``agent_mem_home`` isolates AGENT_MEM_HOME (opt-in, per conftest) so
4+
the write never touches the user's real ~/.agent-mem."""
45

56
from __future__ import annotations
67

78
import importlib.metadata as md
89
import json
910
import os
11+
from pathlib import Path
1012

1113
from agent_mem_daemon import __main__ as dm
12-
from agent_mem_daemon.paths import daemon_state_path
1314

1415

15-
def test_write_daemon_state_records_running_version() -> None:
16+
def test_write_daemon_state_records_running_version(agent_mem_home: Path) -> None:
1617
dm.write_daemon_state("ready")
17-
state = json.loads(daemon_state_path().read_text(encoding="utf-8"))
18+
state = json.loads((agent_mem_home / "daemon.state").read_text(encoding="utf-8"))
1819
assert state["phase"] == "ready"
1920
assert state["pid"] == os.getpid()
2021
# The version of the code this process is running, read from on-disk metadata

0 commit comments

Comments
 (0)