The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test: align upstream fixtures with PM and isolated service ownership
ethernet9b3e84d909f2
diff --git a/tests/hermes_cli/test_container_boot.py b/tests/hermes_cli/test_container_boot.pyindex 4ee2cd537dc..3a0666c948a 100644--- a/tests/hermes_cli/test_container_boot.py+++ b/tests/hermes_cli/test_container_boot.py@@ -10,6 +10,7 @@ tests/docker/test_container_restart.py.from __future__ import annotationsimport json+import osfrom pathlib import Pathimport pytest@@ -48,6 +49,9 @@ def _hermetic_container_argv(monkeypatch: pytest.MonkeyPatch) -> None:"hermes_cli.container_boot._read_container_argv",lambda: (),)+ # This fixture owns real files, but does not run as the image's service user.+ monkeypatch.setattr("hermes_cli.service_manager._HERMES_UID", os.getuid())+ monkeypatch.setattr("hermes_cli.service_manager._HERMES_GID", os.getgid())def _make_profile(diff --git a/tests/scripts/install/test_install_sh_system_package_probe.py b/tests/scripts/install/test_install_sh_system_package_probe.pydeleted file mode 100644index 6f7a84fbda8..00000000000--- a/tests/scripts/install/test_install_sh_system_package_probe.py+++ /dev/null@@ -1,56 +0,0 @@-"""Regression tests for command discovery during system-package setup."""--import shutil-import stat-import subprocess-from pathlib import Path--import pytest---REPO_ROOT = Path(__file__).resolve().parent.parent.parent.parent-INSTALL_SH = REPO_ROOT / "scripts" / "install.sh"--pytestmark = [- pytest.mark.platforms("linux"),- pytest.mark.skipif(shutil.which("bash") is None, reason="needs bash"),-]---def _write_executable(path: Path, body: str) -> None:- path.write_text(f"#!/usr/bin/env bash\n{body}\n")- path.chmod(path.stat().st_mode | stat.S_IXUSR)---def test_system_package_probe_finds_commands_in_link_dir(tmp_path):- bash = shutil.which("bash")- assert bash is not None-- home = tmp_path / "home"- link_dir = home / ".local" / "bin"- path_dir = tmp_path / "path"- link_dir.mkdir(parents=True)- path_dir.mkdir()-- _write_executable(link_dir / "rg", "printf 'ripgrep 14.1.0\\n'")- _write_executable(link_dir / "ffmpeg", "printf 'ffmpeg version 7.1 static\\n'")- _write_executable(path_dir / "head", "IFS= read -r line || true; printf '%s\\n' \"$line\"")- _write_executable(path_dir / "awk", "read -r first second third rest; printf '%s\\n' \"$third\"")-- script = (- f'source "{INSTALL_SH}" --manifest >/dev/null\n'- 'OS=linux\n'- 'DISTRO=unknown\n'- 'install_system_packages\n'- 'printf "ripgrep=%s ffmpeg=%s\\n" "$HAS_RIPGREP" "$HAS_FFMPEG"\n'- )- result = subprocess.run(- [bash, "-c", script],- capture_output=True,- text=True,- check=True,- env={"HOME": str(home), "PATH": str(path_dir)},- )-- assert "ripgrep=true ffmpeg=true" in result.stdout- assert "not installed" not in result.stdout\ No newline at end of filediff --git a/tests/tools/test_computer_use_doctor_stale_units.py b/tests/tools/test_computer_use_doctor_stale_units.pyindex 41457853a03..95799157157 100644--- a/tests/tools/test_computer_use_doctor_stale_units.py+++ b/tests/tools/test_computer_use_doctor_stale_units.py@@ -10,10 +10,12 @@ while every binary-level check stays green. Doctor is the only surface that canimport jsonimport osfrom io import StringIO+from pathlib import Pathfrom unittest.mock import MagicMock, patchimport pytest+from pm.install import InstalledPackagefrom tools.computer_use import doctorpytestmark = pytest.mark.platforms("linux")@@ -39,17 +41,21 @@ def _fake_health_report_proc() -> MagicMock:def _run_doctor_json(monkeypatch, home, daemon_probe=lambda *_a, **_kw: None):- """``daemon_probe`` stands in for ``cua_daemon_listening`` (the Popen double below breaks ``subprocess.run``)."""+ """Keep binary/process I/O fake while exercising the real resolver and unit guards."""monkeypatch.setenv("HOME", str(home))+ monkeypatch.delenv("HERMES_CUA_DRIVER_CMD", raising=False)if "XDG_CONFIG_HOME" in os.environ and not os.environ["XDG_CONFIG_HOME"].startswith(str(home)):monkeypatch.delenv("XDG_CONFIG_HOME") # the host's own config dir must not leak into the scanmonkeypatch.setattr("tools.computer_use.cua_backend.cua_daemon_listening", daemon_probe)monkeypatch.setattr(doctor, "_read_cli_version", lambda binary, timeout=5.0: "cua-driver 0.28.2")+ installed = InstalledPackage(Path("/fake"), "0.28.2", Path("/fake/cua-driver"))out = StringIO()- with patch("shutil.which", return_value="/fake/cua-driver"), \- patch("subprocess.Popen", return_value=_fake_health_report_proc()), \+ with patch("pm.installed_package", return_value=installed) as select, \+ patch.object(doctor, "_open_mcp", return_value=_fake_health_report_proc()) as open_mcp, \patch("sys.stdout", out):code = doctor.run_doctor(json_output=True)+ select.assert_called_once_with("cua-driver")+ open_mcp.assert_called_once_with(str(installed.binary))return code, json.loads(out.getvalue())