From aa0b228c2cab10cc8d6ac2bb20e661437ba6421f Mon Sep 17 00:00:00 2001 From: ruochu88s Date: Mon, 14 Sep 2026 18:31:03 -0700 Subject: [PATCH] test(profiles): default-export tests write through the fixture home, not get_profile_dir("default") get_profile_dir("default") re-resolves the platform-native root at call time; when pytest's basetemp sits inside the operator's Hermes home the per-test sandbox counts as "under the native home" and these two tests overwrote the live config.yaml / .env / MEMORY.md with their stubs. Write through the profile_env fixture's home instead. Taken from #111096 by @ruochu88s (the autouse native-home override and the session tripwire from that PR are not included; the basetemp relocation in tests/conftest.py closes the class). --- tests/hermes_cli/test_profiles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/hermes_cli/test_profiles.py b/tests/hermes_cli/test_profiles.py index bd8e22abb9..605e68a6d1 100644 --- a/tests/hermes_cli/test_profiles.py +++ b/tests/hermes_cli/test_profiles.py @@ -887,7 +887,10 @@ class TestExportImport: def test_export_default_includes_profile_data(self, profile_env, tmp_path): """Profile data files end up in the archive (credentials excluded).""" - default_dir = get_profile_dir("default") + # Write through HERMES_HOME, not get_profile_dir("default"): the latter resolves to the + # OPERATOR's real install whenever basetest sits inside it, so this test used to + # overwrite the live config.yaml / .env / MEMORY.md with its fixtures. + default_dir = profile_env / ".hermes" (default_dir / "config.yaml").write_text("model: test") (default_dir / ".env").write_text("KEY=val") (default_dir / "SOUL.md").write_text("Be nice.") @@ -916,7 +919,8 @@ class TestExportImport: symlinks inside *allowed* artifacts (e.g. ``skills/``) survive as symlinks; the link and its target are both retained. """ - default_dir = get_profile_dir("default") + # Same reason as above: never resolve the operator's real default home from a test. + default_dir = profile_env / ".hermes" (default_dir / "config.yaml").write_text("ok") # Place broken symlink *inside* the allowed ``skills/`` tree so the # root-level allow-list passes the directory through; the