The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tests): isolate suite fixtures from host auth
Daniel Magroc28114a5f8b1
diff --git a/tests/agent/test_anthropic_output_field_leak.py b/tests/agent/test_anthropic_output_field_leak.pyindex 93c05c3e622..138aba2c0ef 100644--- a/tests/agent/test_anthropic_output_field_leak.py+++ b/tests/agent/test_anthropic_output_field_leak.py@@ -10,9 +10,6 @@ Fix: whitelist input-permitted fields per block type at three points —normalize_response capture, _sanitize_replay_block (ordered-blocks replay), and_convert_content_part_to_anthropic (content-list replay)."""-import sys, os-sys.path.insert(0, os.path.expanduser("~/.hermes/hermes-agent"))-import pytestfrom agent.anthropic_adapter import (_sanitize_replay_block,diff --git a/tests/agent/test_credential_pool_routing.py b/tests/agent/test_credential_pool_routing.pyindex d7e68e840ca..61f9e4274c1 100644--- a/tests/agent/test_credential_pool_routing.py+++ b/tests/agent/test_credential_pool_routing.py@@ -371,15 +371,35 @@ class TestFailureAttribution:"""def _make_pool(self, tmp_path, monkeypatch, entries):- monkeypatch.setenv("HERMES_HOME", str(tmp_path / "hermes"))hermes_home = tmp_path / "hermes"hermes_home.mkdir(parents=True, exist_ok=True)+ monkeypatch.setenv("HERMES_HOME", str(hermes_home))+ # Keep host Anthropic/Claude credentials out of this fixture. load_pool()+ # auto-seeds ~/.claude/.credentials.json and env keys when anthropic is+ # explicitly configured on the machine, which turns a deliberate+ # single-entry pool into a multi-entry pool and invalidates isolation+ # assertions (see test_unmatched_key_does_not_retry_only_pool_entry).+ for env_var in (+ "ANTHROPIC_API_KEY",+ "ANTHROPIC_TOKEN",+ "CLAUDE_CODE_OAUTH_TOKEN",+ ):+ monkeypatch.delenv(env_var, raising=False)+ monkeypatch.setattr(+ "hermes_cli.auth.is_provider_explicitly_configured",+ lambda provider: False,+ )(hermes_home / "auth.json").write_text(- json.dumps({"version": 1, "credential_pool": {"anthropic": entries}})+ json.dumps({"version": 1, "credential_pool": {"anthropic": entries}}),+ encoding="utf-8",)from agent.credential_pool import load_pool- return load_pool("anthropic")+ pool = load_pool("anthropic")+ assert [entry.id for entry in pool.entries()] == [+ entry["id"] for entry in entries+ ], "pool fixture leaked host credentials into the test pool"+ return pooldef _entry(self, idx, key, **overrides):entry = {