The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(cron,gateway): drop dead Windows venv setup; say why selected_venv is patched (#122183)
kshitijk4poor86f449b1721f
diff --git a/tests/cron/test_cron_windows_venv_abi.py b/tests/cron/test_cron_windows_venv_abi.pyindex 87867a9eb4a..0e5a584c8a9 100644--- a/tests/cron/test_cron_windows_venv_abi.py+++ b/tests/cron/test_cron_windows_venv_abi.py@@ -14,7 +14,6 @@ in-tree venv."""import os-import sysfrom pathlib import Pathimport pytest@@ -22,17 +21,11 @@ import pytestpytestmark = pytest.mark.platforms("windows")-def _write_venv(venv: Path, base: Path, *, version: str | None = None) -> Path:+def _write_venv(venv: Path) -> Path:"""A fake Windows venv with the ``Scripts/python.exe`` shim a cron child is handed."""(venv / "Lib" / "site-packages").mkdir(parents=True, exist_ok=True)(venv / "Scripts").mkdir(parents=True, exist_ok=True)- base.mkdir(parents=True, exist_ok=True)(venv / "Scripts" / "python.exe").write_text("", encoding="utf-8")- (base / "python.exe").write_text("", encoding="utf-8")- lines = [f"home = {base}", "uv = 0.11.14"]- if version:- lines.append(f"version_info = {version}")- (venv / "pyvenv.cfg").write_text("\n".join(lines) + "\n", encoding="utf-8")return venv@@ -49,18 +42,16 @@ def test_managed_install_uses_the_committed_generation_not_the_in_tree_venv("""The committed generation wins; the leftover pre-PM venv never reaches the child."""from cron import scheduler_script as sched_script- stale = _write_venv(tmp_path / "repo" / "venv", tmp_path / "base")- committed = _write_venv(- tmp_path / "installs" / "gen" / "venv", tmp_path / "genbase",- version=f"{sys.version_info[0]}.{sys.version_info[1]}.7",- )+ stale = _write_venv(tmp_path / "repo" / "venv")+ committed = _write_venv(tmp_path / "installs" / "gen" / "venv")store = tmp_path / "store" / "python.exe"store.parent.mkdir(parents=True)store.write_text("", encoding="utf-8")- child = _write_venv(tmp_path / "child", tmp_path / "childbase")+ child = _write_venv(tmp_path / "child")monkeypatch.setattr("hermes_cli._launchers.resolve_store_python", lambda _root: store)monkeypatch.setattr("pm.environments.committed_venv", lambda _root: committed)+ # Base read selected_venv; pointing it at the stale venv is what makes this red there.monkeypatch.setattr("pm.environments.selected_venv", lambda _root: stale)interpreter, env_overlay = sched_script._windows_cron_python_invocation(diff --git a/tests/gateway/test_windows_venv_import_guard.py b/tests/gateway/test_windows_venv_import_guard.pyindex e0692aef936..69e33574c8c 100644--- a/tests/gateway/test_windows_venv_import_guard.py+++ b/tests/gateway/test_windows_venv_import_guard.py@@ -20,8 +20,6 @@ def test_committed_generation_blocks_the_legacy_venv_overlay(tmp_path, monkeypat(root / "gateway").mkdir(parents=True)legacy = root / "venv"(legacy / "Lib" / "site-packages").mkdir(parents=True)- (legacy / "pyvenv.cfg").write_text(- "home = C:\\py311\nuv = 0.5\nversion_info = 3.11.15\n", encoding="utf-8")generation = tmp_path / "gen"(generation / "Lib" / "site-packages").mkdir(parents=True)