The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: select prepared dependencies for MCP collision fixture
ethernetbe2fab5c3ab0
diff --git a/tests/e2e/core/mcp_plugins/_helpers.py b/tests/e2e/core/mcp_plugins/_helpers.pyindex ed90bf79db1..ff1ea41d863 100644--- a/tests/e2e/core/mcp_plugins/_helpers.py+++ b/tests/e2e/core/mcp_plugins/_helpers.py@@ -14,6 +14,7 @@ import contextlibimport jsonimport osimport re+import shutilimport signalimport subprocessimport sys@@ -119,6 +120,31 @@ class E2EHome:self.config_path.write_text(yaml.safe_dump(cfg, sort_keys=False), encoding="utf-8")+def _select_test_dependencies(eh: E2EHome) -> None:+ """Select the prepared test dependencies inside this fake HOME, not the real install.++ PM's startup selection reads facts from the child's HOME. Without these facts+ each fresh MCP home can bootstrap its own full runtime under CI contention.+ """+ from pm.environments import install_key, site_packages++ test_venv = Path(sys.prefix)+ if not (test_venv / "pyvenv.cfg").is_file():+ return # System Python has no prepared venv to select.+ selected = site_packages(test_venv)+ assert selected.is_dir(), f"test interpreter lacks site-packages: {test_venv}"+ state = eh.hermes_home / "installs" / install_key(REPO_ROOT)+ environment = state / "environments" / "mcp-test" / "venv"+ environment.mkdir(parents=True)+ shutil.copyfile(test_venv / "pyvenv.cfg", environment / "pyvenv.cfg")+ target = environment / selected.relative_to(test_venv)+ target.parent.mkdir(parents=True)+ target.symlink_to(selected, target_is_directory=True)+ (state / "facts.json").write_text(json.dumps({"packages": {"venv": {+ "environment": str(environment),+ }}}), encoding="utf-8")++def build_home(root: Path, base_url: str, *, mcp_servers: dict[str, dict] | None = None,extra: dict[str, Any] | None = None) -> E2EHome:home = root / "home"diff --git a/tests/e2e/core/mcp_plugins/test_plugin_activation.py b/tests/e2e/core/mcp_plugins/test_plugin_activation.pyindex 13a634bb14a..28cfeb03a18 100644--- a/tests/e2e/core/mcp_plugins/test_plugin_activation.py+++ b/tests/e2e/core/mcp_plugins/test_plugin_activation.py@@ -34,6 +34,7 @@ import pytestfrom tests.e2e.core.mcp_plugins._helpers import (FINAL,+ _select_test_dependencies,apply_known,build_home,calls_received,@@ -250,6 +251,8 @@ def name_collision(tmp_path_factory: pytest.TempPathFactory) -> dict[str, Any]:root = tmp_path_factory.mktemp("name_collision")with provider(script((tool_name("srv", "ro_probe"), {"nonce": "dup"}))) as srv:eh = build_home(root, srv.base_url, extra={"plugins": {"enabled": ["foo"]}})+ _select_test_dependencies(eh)+ eh.extra_env["HERMES_DISABLE_LAZY_INSTALLS"] = "1"live = write_portable_plugin(eh, "foo", {"srv": portable_stdio(root / "live.jsonl", eh.tag, MCPE2E_CANARY="CANARY-LIVE")}, name="foo", version="2.0.0")backup = write_portable_plugin(eh, "foo.bak-x", {"srv": portable_stdio(