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).
This commit is contained in:
ruochu88s
2026-09-14 18:31:03 -07:00
committed by Teknium
parent f8eb2912ce
commit aa0b228c2c
+6 -2
View File
@@ -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