Skip to content

The agent that grows with you

test(tools): keep unmocked package dependencies importable

Teknium81e484761f63
diff --git a/tests/tools/test_managed_browserbase_and_modal.py b/tests/tools/test_managed_browserbase_and_modal.py
index 2dae6738a9a..258e9a31495 100644
--- a/tests/tools/test_managed_browserbase_and_modal.py
+++ b/tests/tools/test_managed_browserbase_and_modal.py
@@ -96,14 +96,13 @@ def _install_fake_tools_package():
sys.modules["tools.environments"] = env_package
agent_package = types.ModuleType("agent")
- agent_package.__path__ = [] # type: ignore[attr-defined]
+ agent_package.__path__ = [str(REPO_ROOT / "agent")] # type: ignore[attr-defined]
sys.modules["agent"] = agent_package
sys.modules["agent.auxiliary_client"] = types.SimpleNamespace(
call_llm=lambda *args, **kwargs: "",
)
- # The fake `agent` package has an empty __path__, so every real
- # agent.* submodule that production code imports needs an explicit
- # stand-in here. tools.browser_tool imports redact_cdp_url;
+ # Keep unrelated imports real; only replace the collaborators this fixture
+ # isolates. tools.browser_tool imports redact_cdp_url;
# hermes_cli.auth (imported transitively by nous_account /
# tool_backend_helpers) imports sanitize_borrowed_credential_payload.
sys.modules["agent.redact"] = types.SimpleNamespace(
@@ -114,8 +113,7 @@ def _install_fake_tools_package():
)
# Stubs for the browser-provider plugin layer introduced in PR #25214.
- # The fake `agent` package has an empty __path__ so real submodules
- # aren't reachable; we install just enough stand-ins to satisfy
+ # Install just enough stand-ins to isolate
# ``tools.browser_tool``'s top-level imports. The actual lifecycle
# tests instantiate the real plugin classes via _load_tool_module
# below, so the stubs only need to satisfy import + isinstance.
diff --git a/tests/tools/test_modal_snapshot_isolation.py b/tests/tools/test_modal_snapshot_isolation.py
index d6d20e69273..2f7911b385e 100644
--- a/tests/tools/test_modal_snapshot_isolation.py
+++ b/tests/tools/test_modal_snapshot_isolation.py
@@ -60,7 +60,7 @@ def _install_modal_test_modules(
_reset_modules(("tools", "hermes_cli", "modal"))
hermes_cli = types.ModuleType("hermes_cli")
- hermes_cli.__path__ = [] # type: ignore[attr-defined]
+ hermes_cli.__path__ = [str(REPO_ROOT / "hermes_cli")] # type: ignore[attr-defined]
sys.modules["hermes_cli"] = hermes_cli
hermes_home = tmp_path / "hermes-home"
os.environ["HERMES_HOME"] = str(hermes_home)