The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tests): keep MagicMock home paths out of the repo checkout
Teknium4976fa223d82
diff --git a/tests/gateway/test_platform_reconnect.py b/tests/gateway/test_platform_reconnect.pyindex d7f3b685e44..6924059f784 100644--- a/tests/gateway/test_platform_reconnect.py+++ b/tests/gateway/test_platform_reconnect.py@@ -74,6 +74,11 @@ def _make_runner():runner._honcho_configs = {}runner._shutdown_all_gateway_honcho = lambda: Nonerunner.session_store = MagicMock()+ # A bare MagicMock attribute is os.fspath()-able as the RELATIVE path "MagicMock/<name>/<id>":+ # startup's heartbeat restore treats ``_routing_home`` as the launch home and would build a+ # profile home (state.db, SOUL.md) under the cwd, i.e. the repo checkout. None falls back to+ # the test's isolated HERMES_HOME.+ runner.session_store._routing_home = Nonereturn runnerdiff --git a/tests/tui_gateway/test_protocol.py b/tests/tui_gateway/test_protocol.pyindex c061fc369ba..41697ed77d6 100644--- a/tests/tui_gateway/test_protocol.py+++ b/tests/tui_gateway/test_protocol.py@@ -39,8 +39,10 @@ def server():# server's ``current_transport()`` never reads (first-in-process test sees ``_stdio_transport`` as caller).import tui_gateway.server_requestsimport tui_gateway.transport+ import hermes_constants # real get_process_hermes_home: a mocked one put state.db under the cwd (repo)with patch.dict("sys.modules", {- "hermes_constants": MagicMock(get_hermes_home=MagicMock(return_value="/tmp/hermes_test")),+ "hermes_constants": MagicMock(get_hermes_home=MagicMock(return_value="/tmp/hermes_test"),+ get_process_hermes_home=hermes_constants.get_process_hermes_home),"hermes_cli.env_loader": MagicMock(),"hermes_cli.banner": MagicMock(),"hermes_state": MagicMock(),@@ -70,8 +72,6 @@ def server():mod._live_transports.clear()--@pytest.fixture()def capture(server):"""Redirect server's real stdout to a StringIO and return (server, buf)."""diff --git a/tests/tui_gateway/test_review_summary_callback.py b/tests/tui_gateway/test_review_summary_callback.pyindex 54c5300b7b6..fe2b1a4aed5 100644--- a/tests/tui_gateway/test_review_summary_callback.py+++ b/tests/tui_gateway/test_review_summary_callback.py@@ -15,6 +15,12 @@ from unittest.mock import MagicMock, patchimport pytest+# The real resolver goes into the mocked module: server._launch_home() calls it for the launch+# state.db, and a MagicMock's return value is os.fspath()-able as the RELATIVE path+# "MagicMock/<name>/<id>", so the store landed in the cwd (the repo checkout). The real one+# follows the test's isolated HERMES_HOME.+from hermes_constants import get_process_hermes_home as _real_get_process_hermes_home+@pytest.fixture()def server():@@ -24,7 +30,8 @@ def server():"sys.modules",{"hermes_constants": MagicMock(- get_hermes_home=MagicMock(return_value="/tmp/hermes_test_review_summary")+ get_hermes_home=MagicMock(return_value="/tmp/hermes_test_review_summary"),+ get_process_hermes_home=_real_get_process_hermes_home,),"hermes_cli.env_loader": MagicMock(),"hermes_cli.banner": MagicMock(),