Skip to content

The agent that grows with you

test: repoint WSL/container probe patches to hermes_platform.host.runtime (group A)

alt-glitcha6b236486245
diff --git a/tests/hermes_cli/test_desktop_wsl_gpu.py b/tests/hermes_cli/test_desktop_wsl_gpu.py
index f4b2cbd2ae4..9f40c77e288 100644
--- a/tests/hermes_cli/test_desktop_wsl_gpu.py
+++ b/tests/hermes_cli/test_desktop_wsl_gpu.py
@@ -4,8 +4,8 @@ its GPU process (#106117) — and never overrides an explicit Mesa choice or fir
import argparse
from pathlib import Path
-import hermes_constants
from hermes_cli import main_desktop
+from hermes_platform.host import runtime as host_runtime
def _launch_env(monkeypatch, tmp_path, *, wsl: bool, dxg: bool, driver: bool) -> dict:
@@ -18,7 +18,7 @@ def _launch_env(monkeypatch, tmp_path, *, wsl: bool, dxg: bool, driver: bool) ->
dxg_path.touch()
if driver:
driver_path.write_bytes(b"\x7fELF")
- monkeypatch.setattr(hermes_constants, "_wsl_detected", wsl)
+ monkeypatch.setattr(host_runtime, "_wsl_detected", wsl)
monkeypatch.setattr(main_desktop, "_WSL_DXG_DEVICE", dxg_path)
monkeypatch.setattr(main_desktop, "_WSL_D3D12_DRIVERS", (tmp_path / "missing_dri.so", driver_path))
monkeypatch.setattr(main_desktop, "_desktop_launch_options", lambda: ([], "auto", "auto", "auto"))
diff --git a/tests/hermes_cli/test_gateway_wsl.py b/tests/hermes_cli/test_gateway_wsl.py
index 6e7ff379327..bc10b33e52e 100644
--- a/tests/hermes_cli/test_gateway_wsl.py
+++ b/tests/hermes_cli/test_gateway_wsl.py
@@ -8,6 +8,7 @@ import pytest
import hermes_cli.gateway as gateway
import hermes_constants
+from hermes_platform.host import runtime as host_runtime
# =============================================================================
@@ -19,7 +20,7 @@ class TestIsWsl:
def setup_method(self):
# Reset cached value between tests
- hermes_constants._wsl_detected = None
+ host_runtime._wsl_detected = None
def test_detects_wsl2(self):
fake_content = (
diff --git a/tests/test_hermes_constants.py b/tests/test_hermes_constants.py
index 0d0881391dc..ae2e813f604 100644
--- a/tests/test_hermes_constants.py
+++ b/tests/test_hermes_constants.py
@@ -8,6 +8,7 @@ from types import SimpleNamespace
import pytest
import hermes_constants
+from hermes_platform.host import runtime as host_runtime
from hermes_constants import (
VALID_REASONING_EFFORTS,
agent_browser_runnable,
@@ -376,7 +377,7 @@ class TestIsContainer:
def _reset_cache(self, monkeypatch):
"""Reset the cached detection result before each test."""
- monkeypatch.setattr(hermes_constants, "_container_detected", None)
+ monkeypatch.setattr(host_runtime, "_container_detected", None)
def test_detects_dockerenv(self, monkeypatch, tmp_path):
"""/.dockerenv triggers container detection."""
@@ -400,8 +401,6 @@ class TestIsContainer:
"""#58135: a host that merely RUNS containers exposes each container's overlay lowerdir
(``lowerdir=/var/lib/containerd/...``) at non-root mount points; only the root ('/') line
says whether *this* process lives in a runtime overlay."""
- from hermes_constants import _root_mount_has_marker
-
markers = ("kubepods", "containerd", "crio")
host = tmp_path / "host"
host.write_text(
@@ -415,13 +414,13 @@ class TestIsContainer:
"rw,lowerdir=/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs/snapshots/9/fs\n"
"2 1 0:51 / /proc rw,nosuid - proc proc rw\n"
)
- assert _root_mount_has_marker(str(host), markers) is False
- assert _root_mount_has_marker(str(container), markers) is True
- assert _root_mount_has_marker(str(tmp_path / "missing"), markers) is False
+ assert host_runtime._root_mount_has_marker(str(host), markers) is False
+ assert host_runtime._root_mount_has_marker(str(container), markers) is True
+ assert host_runtime._root_mount_has_marker(str(tmp_path / "missing"), markers) is False
def test_caches_result(self, monkeypatch):
"""Second call uses cached value without re-probing."""
- monkeypatch.setattr(hermes_constants, "_container_detected", True)
+ monkeypatch.setattr(host_runtime, "_container_detected", True)
assert is_container() is True
# Even if we make os.path.exists return False, cached value wins
monkeypatch.setattr(os.path, "exists", lambda p: False)