From aae6e52005961446aa7f6617d319911518743ab3 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 29 Jul 2026 18:31:56 -0700 Subject: [PATCH] test: opt install-ladder tests back into lazy installs under the hermetic gate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HERMES_DISABLE_LAZY_INSTALLS=1 conftest gate (from #43782) correctly blocks real mid-run pip installs suite-wide, but TestInstallDependenciesRunner exercises the install ladder itself against a fully mocked subprocess.run — it needs the gate open. Same both-directions override pattern tests/tools/test_lazy_deps.py already uses. Sibling sweep of all install_specs/_pip_install/ensurepip test files: 274 tests green. --- tests/hermes_cli/test_memory_setup_provider_arg.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/hermes_cli/test_memory_setup_provider_arg.py b/tests/hermes_cli/test_memory_setup_provider_arg.py index d2a6a340fe525..7df85c3156e26 100644 --- a/tests/hermes_cli/test_memory_setup_provider_arg.py +++ b/tests/hermes_cli/test_memory_setup_provider_arg.py @@ -42,7 +42,9 @@ class TestInstallDependenciesRunner: def _run_with_missing_dep(self, tmp_path, which_side_effect, run_behavior=None): """Drive _install_dependencies for a plugin that declares one missing pip dep, capturing every subprocess.run argv issued by the ladder.""" + import os import sys + from unittest.mock import patch as _patch (tmp_path / "plugin.yaml").write_text( "pip_dependencies:\n - definitely-not-installed-xyz\n", encoding="utf-8" @@ -55,7 +57,13 @@ class TestInstallDependenciesRunner: return run_behavior(cmd) return SimpleNamespace(returncode=0, stdout="", stderr="") - with patch("plugins.memory.find_provider_dir", return_value=tmp_path), \ + # The hermetic conftest sets HERMES_DISABLE_LAZY_INSTALLS=1 so no test + # can trigger a real mid-run pip install. These tests exercise the + # install ladder itself (against a fully mocked subprocess.run), so + # they opt back in — the same both-directions override + # tests/tools/test_lazy_deps.py uses. + with _patch.dict(os.environ, {"HERMES_DISABLE_LAZY_INSTALLS": "0"}), \ + patch("plugins.memory.find_provider_dir", return_value=tmp_path), \ patch("hermes_cli.tools_config.shutil.which", side_effect=which_side_effect), \ patch("hermes_cli.tools_config.subprocess.run", fake_run): memory_setup._install_dependencies("x")