The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(pm): register venv through the pm_env fixture, not monkeypatch.setitem
etherneta02e67266b65
diff --git a/tests/pm/test_pm_core.py b/tests/pm/test_pm_core.pyindex 479dce44677..f7c9f77efa9 100644--- a/tests/pm/test_pm_core.py+++ b/tests/pm/test_pm_core.py@@ -14,7 +14,7 @@ import pm.paths as pathsimport pm.registry as registryfrom pm.lock import Facts, Lockfilefrom pm.package import InstallError, compose_env-from pm.packages import BinaryPackage+from pm.packages import BinaryPackage, Venvfrom pm.store import Store, current_targetfrom tests.pm._fixtures import make_tar, served as served@@ -71,9 +71,12 @@ def pm_env(tmp_path, served, monkeypatch):ensure_mod = importlib.import_module("pm.install")monkeypatch.setattr(ensure_mod, "lazy_installs_allowed", lambda: True)+ # Restore the real registry wholesale on teardown. Tests must not+ # monkeypatch.setitem into the cleared dict: that undo runs after this+ # restore and deletes the built-in entry from the live registry.saved = dict(registry._packages)registry._packages.clear()- for cls in (FakeTool, DepTool, TopTool, MultiTool):+ for cls in (FakeTool, DepTool, TopTool, MultiTool, Venv):registry._packages[cls.name] = cls()FakeTool.base_url = base_urlMultiTool.base_url = base_url@@ -243,7 +246,6 @@ def test_install_forgets_verification_when_state_operation_releases_lock(pm_env,import osfrom hermes_cli.runtime_state import _lockfrom pm.cli import _install_names- from pm.packages import Venvensure = importlib.import_module("pm.install")lockfile_path, runtime, docroot, _ = pm_env@@ -266,7 +268,6 @@ def test_install_forgets_verification_when_state_operation_releases_lock(pm_env,os.close(fd)monkeypatch.setattr(ensure, "sync_venv", sync)- monkeypatch.setitem(registry._packages, "venv", Venv())assert _install_names(["deptool", "venv", "toptool"]) == 0assert binary.read_text(encoding="utf-8") == "deptool"