Skip to content

The agent that grows with you

test: stop relying on the in-tree venv after #122161

ethernete3d43c3c2412
diff --git a/tests/hermes_cli/test_source_launcher_publication.py b/tests/hermes_cli/test_source_launcher_publication.py
index 3b7aff3e699..43a95986312 100644
--- a/tests/hermes_cli/test_source_launcher_publication.py
+++ b/tests/hermes_cli/test_source_launcher_publication.py
@@ -146,9 +146,7 @@ def test_profile_publication_preserves_shared_launcher_default_home(tmp_path, mo
(repo / "install-stamp.json").write_text(json.dumps({
"commit": "abcdef012345", "updateMechanism": "git", "runtimeDir": str(home / "tools"),
}), encoding="utf-8")
- site = site_packages(repo / "venv")
- site.mkdir(parents=True)
- (site / "selected_probe.py").write_text("VALUE = 'ready'\n", encoding="utf-8")
+ select_generation(repo, "shared", "ready")
out = tmp_path / ".local" / "bin"
if publisher == "cmd":
monkeypatch.setattr(_launchers, "_load_script_maker", lambda: None)
@@ -191,6 +189,9 @@ def test_profile_publication_preserves_shared_launcher_default_home(tmp_path, mo
assert_home(profile, profile)
other_home = tmp_path / "explicit custom home"
other_home.mkdir()
+ # A custom home is its own dependency root: it sees only generations committed there.
+ monkeypatch.setenv("HERMES_HOME", str(other_home))
+ select_generation(repo, "shared", "ready")
assert_home(other_home, other_home)
@@ -427,15 +428,13 @@ def test_dashboard_action_boots_selected_dependencies(tmp_path, monkeypatch):
proc.wait(timeout=30)
[email protected]("layout", ["legacy", "payload"])
-def test_pre_pm_base_dependencies_activate_only_at_boot(tmp_path, monkeypatch, layout):
+def test_pre_pm_base_dependencies_activate_only_at_boot(tmp_path, monkeypatch):
+ # The in-tree pre-PM venv is never activated; only a sealed payload's own environment is.
repo, home, _ = fixture_tree(tmp_path, monkeypatch)
- environment = repo / "venv"
- if layout == "payload":
- environment = repo.parent / "payload-deps"
- (repo.parent / "manifest.json").write_text(
- json.dumps({"repo": repo.name, "venv": environment.name,
- "store": (home / "tools").relative_to(repo.parent).as_posix()}), encoding="utf-8")
+ environment = repo.parent / "payload-deps"
+ (repo.parent / "manifest.json").write_text(
+ json.dumps({"repo": repo.name, "venv": environment.name,
+ "store": (home / "tools").relative_to(repo.parent).as_posix()}), encoding="utf-8")
site = site_packages(environment)
site.mkdir(parents=True)
editable = tmp_path / "editable"
@@ -464,9 +463,7 @@ def test_service_survives_python_tool_replacement(tmp_path, monkeypatch):
repo, home, interpreter = fixture_tree(tmp_path, monkeypatch)
monkeypatch.setattr(gateway, "PROJECT_ROOT", repo)
- site = site_packages(repo / "venv")
- site.mkdir(parents=True)
- (site / "selected_probe.py").write_text("VALUE = 'ready'\n", encoding="utf-8")
+ select_generation(repo, "shared", "ready")
store = home / "tools"
for version in ("python-A", "python-B"):
python = store / version / "bin" / "python3"
@@ -493,9 +490,7 @@ def test_sync_migrates_old_store_wrapper_before_python_collection(tmp_path, monk
repo, home, interpreter = fixture_tree(tmp_path, monkeypatch)
monkeypatch.setattr(Path, "home", lambda: home)
- site = site_packages(repo / "venv")
- site.mkdir(parents=True)
- (site / "selected_probe.py").write_text("VALUE = 'ready'\n", encoding="utf-8")
+ select_generation(repo, "shared", "ready")
out = home / ".local/bin"
out.mkdir(parents=True)
if not create:
diff --git a/tests/pm/test_activate_scripts.py b/tests/pm/test_activate_scripts.py
index ca883996da0..f93ea56f17f 100644
--- a/tests/pm/test_activate_scripts.py
+++ b/tests/pm/test_activate_scripts.py
@@ -370,5 +370,6 @@ def test_powershell_activate_exports_and_deactivates(tmp_path: Path):
capture_output=True, text=True, cwd=str(tmp_path), env=env, timeout=40,
)
assert result.returncode == 0, result.stdout + result.stderr
- assert f"active={root}{os.pathsep}" in result.stdout
+ # Nothing is committed, so the checkout alone: the bootstrap .venv's packages never leak in.
+ assert f"active={root}\n" in result.stdout
assert "after=caller-original" in result.stdout
diff --git a/tests/scripts/test_mint_launchers.py b/tests/scripts/test_mint_launchers.py
index 4d7decd549b..c3643bf9d62 100644
--- a/tests/scripts/test_mint_launchers.py
+++ b/tests/scripts/test_mint_launchers.py
@@ -84,6 +84,9 @@ def payload_tree(tmp_path: Path):
encoding="utf-8",
)
(site / "stubdep.py").write_text("X = 1\n", encoding="utf-8")
+ # Real payloads ship this beside repo/ (scripts/build/agent.py); boot selects its venv from it.
+ (tmp_path / "stage" / "manifest.json").write_text(
+ json.dumps({"schema": 1, "repo": "repo", "venv": "venv", "store": "tools"}), encoding="utf-8")
return {"bin": bin_dir, "root": tmp_path / "stage", "tmp": tmp_path, "site": site, "repo": repo}