The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: --version and update --check subprocess tests no longer wait on GitHub
Teknium630fb2ce3c04
diff --git a/tests/hermes_cli/test_kanban_db.py b/tests/hermes_cli/test_kanban_db.pyindex ca9989879eb..a9581cdc094 100644--- a/tests/hermes_cli/test_kanban_db.py+++ b/tests/hermes_cli/test_kanban_db.py@@ -1593,9 +1593,8 @@ def test_resolve_hermes_argv_prefers_module_form_over_path_shim(monkeypatch):-def test_resolve_hermes_argv_module_actually_runs():- """The fallback module name must be importable + runnable.+ """The fallback module name must be importable + runnable (offline: the update check is not under test).A unit test that pins the literal string is necessary but notsufficient — if `hermes_cli.main` ever loses `if __name__ == "__main__"`@@ -1612,7 +1611,8 @@ def test_resolve_hermes_argv_module_actually_runs():os.environ.pop("HERMES_BIN", None)with mock.patch.object(shutil, "which", return_value=None):argv = kbd._resolve_hermes_argv()- r = subprocess.run(argv + ["--version"], capture_output=True, text=True, timeout=30, check=False)+ offline = {**os.environ, "HTTPS_PROXY": "http://127.0.0.1:9", "https_proxy": "http://127.0.0.1:9", "NO_PROXY": ""}+ r = subprocess.run(argv + ["--version"], capture_output=True, text=True, timeout=30, check=False, env=offline)assert r.returncode == 0, (f"`{' '.join(argv)} --version` failed (rc={r.returncode}); "f"stderr={r.stderr[:200]!r}"diff --git a/tests/hermes_cli/test_lazy_secrets_dispatch.py b/tests/hermes_cli/test_lazy_secrets_dispatch.pyindex 1d2f3e732c0..1fddffcf476 100644--- a/tests/hermes_cli/test_lazy_secrets_dispatch.py+++ b/tests/hermes_cli/test_lazy_secrets_dispatch.py@@ -46,6 +46,12 @@ def _run_hermes(args: list[str], timeout: int = 30) -> subprocess.CompletedProce"GIT_CONFIG_VALUE_0": "https://","GIT_CONFIG_KEY_1": "url.file:///nonexistent-hermes-test-remote/.insteadOf","GIT_CONFIG_VALUE_1": "git@",+ # The channel resolver reads GitHub's API over urllib, which the git+ # rewrite cannot reach: a dead local proxy fails it just as fast.+ "HTTPS_PROXY": "http://127.0.0.1:9",+ "https_proxy": "http://127.0.0.1:9",+ "NO_PROXY": "",+ "no_proxy": "",})return subprocess.run(diff --git a/tests/hermes_cli/test_startup_fast_guards.py b/tests/hermes_cli/test_startup_fast_guards.pyindex 085f6cf3650..36994bc5143 100644--- a/tests/hermes_cli/test_startup_fast_guards.py+++ b/tests/hermes_cli/test_startup_fast_guards.py@@ -94,8 +94,16 @@ def test_startup_fast_import_weight():)+# A dead local proxy: every HTTP(S) call (GitHub's API, a git https fetch) fails at once.+_OFFLINE = {"HTTPS_PROXY": "http://127.0.0.1:9", "HTTP_PROXY": "http://127.0.0.1:9",+ "https_proxy": "http://127.0.0.1:9", "http_proxy": "http://127.0.0.1:9",+ "NO_PROXY": "", "no_proxy": ""}++def _run_version(env_overrides: dict) -> subprocess.CompletedProcess:- env = {**os.environ, **env_overrides}+ # --version's update check is not under test; offline it answers at once instead of+ # waiting out GitHub's 30 s API and 60 s ls-remote timeouts (the test's own budget).+ env = {**os.environ, **_OFFLINE, **env_overrides}env.pop("HERMES_DEV", None)return subprocess.run([sys.executable, "-m", "hermes_cli.main", "--version"],