From 79fd4b64c233aa4b5ed9564f7e3818914df4df8a Mon Sep 17 00:00:00 2001 From: AJV20 <24819659+AJV20@users.noreply.github.com> Date: Thu, 28 May 2026 14:56:28 -0400 Subject: [PATCH] test: make gateway context test self-contained --- tests/test_webui_prefill_context.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_webui_prefill_context.py b/tests/test_webui_prefill_context.py index 336d30cc..4c13a15f 100644 --- a/tests/test_webui_prefill_context.py +++ b/tests/test_webui_prefill_context.py @@ -3,6 +3,7 @@ from __future__ import annotations import json import sys +import types from pathlib import Path @@ -209,10 +210,11 @@ def test_webui_session_context_adds_gateway_like_metadata(monkeypatch, tmp_path) def __truediv__(self, name): return gateway_state if name == "gateway_state.json" else tmp_path / name - import hermes_constants - - monkeypatch.setattr(hermes_constants, "get_hermes_home", lambda: FakeHome()) - monkeypatch.setattr(hermes_constants, "display_hermes_home", lambda: "/tmp/hermes-test-home") + fake_constants = types.SimpleNamespace( + get_hermes_home=lambda: FakeHome(), + display_hermes_home=lambda: "/tmp/hermes-test-home", + ) + monkeypatch.setitem(sys.modules, "hermes_constants", fake_constants) messages = _prefill_messages_with_webui_context( {"messages": [{"role": "user", "content": "recall"}]},