Files
hermes-agent/tests/test_managed_runtime_resolution.py
ethernet 1bf588234c refactor(build): share product recipes across distributions
Build TUI, web, desktop UI and runnable agent products from explicit
prepared inputs. Keep dependency preparation separate from distribution
packaging, with PM and native builds sharing uv environment construction.

Docker copies compiled frontend products instead of build dependencies.
Nix retains uv2nix environments and consumes shared assembly through store
references. Native desktop and Termux use the same launcher and frontend
contracts. Preserve the independent PM runtime and source imports from
arbitrary working directories.

Keep failed frontend builds from replacing the previous product, reject
source/output overlap, and bound dependency-process output draining.
Include hermes_wisdom in the Nix wheel: real CLI smoke tests exposed its
missing package declaration on the base revision too.

Verified focused Python and JavaScript suites, Docker build/runtime checks,
Nix desktop and CLI/ACP checks, standalone TUI and packaged Electron PTY,
and real full-Chromium interaction. Native signed installers, Android device
installation and the full repository suite remain CI verification.
2026-09-11 13:16:55 -04:00

36 lines
1.7 KiB
Python

"""Workspace commands preserve PM's toolchain instead of consulting PATH."""
import importlib
import shutil
import subprocess
import pytest
from pm import workspace
from pm.package import InstallError
def test_workspace_uv_preserves_managed_tool_and_interpreter(monkeypatch, tmp_path):
ensure = importlib.import_module("pm.ensure")
monkeypatch.setattr(ensure, "uv", lambda **kwargs: ("managed/uv", {"UV_PYTHON": "managed/python", "UV_CACHE_DIR": str(tmp_path / "cache")}))
monkeypatch.setattr(workspace, "_generate_pyproject", lambda *args, **kwargs: (tmp_path, False))
def reject_path(*args, **kwargs):
raise AssertionError("workspace commands must not resolve tools from PATH")
monkeypatch.setattr(shutil, "which", reject_path)
calls = []
def run(cmd, **kwargs):
calls.append((cmd, kwargs["env"]))
return subprocess.CompletedProcess(cmd, 0, "", "")
monkeypatch.setattr(workspace.subprocess, "run", run)
workspace.lock_and_sync([], venv_dir=tmp_path / "venv", root=tmp_path)
assert [cmd[1] for cmd, _ in calls] == ["lock", "sync"]
assert all(cmd[0] == "managed/uv" and env["UV_PYTHON"] == "managed/python" for cmd, env in calls)
def test_workspace_uv_missing_toolchain_never_falls_back(monkeypatch, tmp_path):
ensure = importlib.import_module("pm.ensure")
monkeypatch.setattr(ensure, "uv", lambda **kwargs: (None, {}))
monkeypatch.setattr(workspace, "_generate_pyproject", lambda *args, **kwargs: (tmp_path, False))
monkeypatch.setattr(shutil, "which", lambda name: "developer/uv")
with pytest.raises(InstallError, match="PM's uv and Python"):
workspace.lock_and_sync([], venv_dir=tmp_path / "venv", root=tmp_path)