From 1964b0565b96b15ac8435d522de5844aec2261a6 Mon Sep 17 00:00:00 2001 From: Clooooode Date: Sun, 3 May 2026 11:39:40 +1200 Subject: [PATCH] test(kanban): add failing test for list_profiles_on_disk with custom HERMES_HOME list_profiles_on_disk() hardcodes Path.home() / ".hermes" / "profiles", ignoring HERMES_HOME when set to a custom root (e.g. /opt/data). Add test_list_profiles_on_disk_custom_root to cover this case. Related to #18442, #18985. --- .../test_kanban_core_functionality.py | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/hermes_cli/test_kanban_core_functionality.py b/tests/hermes_cli/test_kanban_core_functionality.py index 551480ff72..a7896bf940 100644 --- a/tests/hermes_cli/test_kanban_core_functionality.py +++ b/tests/hermes_cli/test_kanban_core_functionality.py @@ -902,12 +902,13 @@ def test_list_profiles_on_disk(tmp_path, monkeypatch): """list_profiles_on_disk returns directories under ~/.hermes/profiles/ that contain a config.yaml.""" monkeypatch.setattr(Path, "home", lambda: tmp_path) + monkeypatch.delenv("HERMES_HOME", raising=False) profiles = tmp_path / ".hermes" / "profiles" profiles.mkdir(parents=True) - (profiles / "researcher").mkdir() - (profiles / "researcher" / "config.yaml").write_text("model: {}\n") - (profiles / "writer").mkdir() - (profiles / "writer" / "config.yaml").write_text("model: {}\n") + for name in ("researcher", "writer"): + d = profiles / name + d.mkdir() + (d / "config.yaml").write_text("model: {}\n") (profiles / "empty_dir").mkdir() # A stray file; should be ignored. (profiles / "stray.txt").write_text("noise") @@ -916,6 +917,20 @@ def test_list_profiles_on_disk(tmp_path, monkeypatch): assert names == ["researcher", "writer"] +def test_list_profiles_on_disk_custom_root(tmp_path, monkeypatch): + """list_profiles_on_disk respects a custom HERMES_HOME root.""" + monkeypatch.setenv("HERMES_HOME", str(tmp_path)) + profiles = tmp_path / "profiles" + profiles.mkdir(parents=True) + for name in ("researcher", "writer"): + d = profiles / name + d.mkdir() + (d / "config.yaml").write_text("model: {}\n") + + names = kb.list_profiles_on_disk() + assert names == ["researcher", "writer"] + + def test_known_assignees_merges_disk_and_board(tmp_path, monkeypatch): """known_assignees unions profiles on disk with currently-assigned names, and reports per-status counts."""