From 0bdf33b7d9f005bb2a98d6902e6ac60f0fca55c6 Mon Sep 17 00:00:00 2001 From: alt-glitch Date: Sun, 20 Sep 2026 19:08:10 +0530 Subject: [PATCH] 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. --- tests/acp_adapter/test_session.py | 8 ++++---- tests/tools/test_clipboard.py | 17 ++++++----------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/tests/acp_adapter/test_session.py b/tests/acp_adapter/test_session.py index d7a95ecef9..d692569e89 100644 --- a/tests/acp_adapter/test_session.py +++ b/tests/acp_adapter/test_session.py @@ -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") diff --git a/tests/tools/test_clipboard.py b/tests/tools/test_clipboard.py index 0f50340037..ad99c915aa 100644 --- a/tests/tools/test_clipboard.py +++ b/tests/tools/test_clipboard.py @@ -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):