Skip to content

The agent that grows with you

test: seed the version cache once per test process instead of shelling out to git

teknium17c338c9ba359
diff --git a/tests/conftest.py b/tests/conftest.py
index 1c7195fe2f9..ccc7959a53f 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -35,6 +35,15 @@ PROJECT_ROOT = Path(__file__).parent.parent
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
+# Every test file runs in its own process, and in a checkout without an install stamp
+# get_version_info() shells out to git 7 times (~0.55 s per process in a large local
+# clone; a whole local suite run spent ~48 CPU-minutes there). Seed the shape a shallow
+# CI checkout resolves to; tests of version resolution call _reset_version_info_cache().
+from hermes_cli import version_info as _version_info # noqa: E402
+
+_version_info._cached_version_info = _version_info.VersionInfo(
+ "unknown", "git.0000000", None, "0" * 40, "main", "git")
+
# ── Sandbox HERMES_HOME before ANY test module is imported ──────────────────
# `hermes_cli/main.py` calls `setup_logging()` at MODULE level, which resolves