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

The probe cache now belongs to hermes_platform.host.runtime.
Call-site name patches stay where production resolves them.
This commit is contained in:
alt-glitch
2026-09-20 19:08:10 +05:30
committed by GitHub
parent 724783a675
commit 0bdf33b7d9
2 changed files with 10 additions and 15 deletions

View File

@@ -46,7 +46,7 @@ class TestCreateSession:
captured["task_id"] = task_id
captured["overrides"] = overrides
monkeypatch.setattr("hermes_constants._wsl_detected", True)
monkeypatch.setattr("hermes_platform.host.runtime._wsl_detected", True)
monkeypatch.setattr(
"tools.terminal_tool.register_task_env_overrides",
fake_register_task_env_overrides,
@@ -204,7 +204,7 @@ class TestCreateSession:
class TestWslCwdTranslation:
def test_translate_acp_cwd_converts_windows_drive_path_when_wsl(self, monkeypatch):
monkeypatch.setattr("hermes_constants._wsl_detected", True)
monkeypatch.setattr("hermes_platform.host.runtime._wsl_detected", True)
assert acp_session._translate_acp_cwd(r"E:\Projects\AI\paperclip") == "/mnt/e/Projects/AI/paperclip"
@@ -213,7 +213,7 @@ class TestWslCwdTranslation:
def test_fork_session_stores_translated_cwd_on_wsl(self, manager, monkeypatch):
monkeypatch.setattr("hermes_constants._wsl_detected", True)
monkeypatch.setattr("hermes_platform.host.runtime._wsl_detected", True)
original = manager.create_session(cwd="/tmp/base")
forked = manager.fork_session(original.session_id, cwd=r"D:\work\project")
@@ -222,7 +222,7 @@ class TestWslCwdTranslation:
assert forked.cwd == "/mnt/d/work/project"
def test_update_cwd_stores_translated_cwd_on_wsl(self, manager, monkeypatch):
monkeypatch.setattr("hermes_constants._wsl_detected", True)
monkeypatch.setattr("hermes_platform.host.runtime._wsl_detected", True)
state = manager.create_session(cwd="/tmp/old")
updated = manager.update_cwd(state.session_id, cwd=r"C:\Users\foo\project")

View File

@@ -17,6 +17,7 @@ from unittest.mock import patch, MagicMock, mock_open
import pytest
from hermes_platform.host import runtime as host_runtime
from hermes_cli.clipboard import (
save_clipboard_image,
has_clipboard_image,
@@ -173,18 +174,14 @@ class TestMacosClipboardFileUrl:
class TestIsWsl:
def setup_method(self):
# _is_wsl is hermes_constants.is_wsl; reset the function's own module
# globals so this stays stable even if hermes_constants was imported
# through a different module object earlier in a large xdist run.
import hermes_constants
hermes_constants._wsl_detected = None
# Reset the cache in the module that owns _is_wsl.
host_runtime._wsl_detected = None
_is_wsl.__globals__["_wsl_detected"] = None
def teardown_method(self):
# Reset again after the test so we don't leak a cached value
# (True/False) into whichever test the xdist worker runs next.
import hermes_constants
hermes_constants._wsl_detected = None
host_runtime._wsl_detected = None
_is_wsl.__globals__["_wsl_detected"] = None
@pytest.mark.parametrize("content, expected", [
@@ -343,8 +340,7 @@ class TestLinuxSave:
"""Test that _linux_save dispatches correctly to WSL → Wayland → X11."""
def setup_method(self):
import hermes_cli.clipboard as cb
cb._wsl_detected = None
host_runtime._wsl_detected = None
def test_wsl_tried_first(self, tmp_path):
dest = tmp_path / "out.png"
@@ -458,8 +454,7 @@ class TestConvertToPng:
class TestHasClipboardImage:
def setup_method(self):
import hermes_cli.clipboard as cb
cb._wsl_detected = None
host_runtime._wsl_detected = None
@pytest.mark.macos_only
def test_macos_dispatch(self):