Skip to content

The agent that grows with you

test: repair release and host probe seams

ethernet9e421e2fb7de
diff --git a/tests/hermes_cli/test_serve_skill_maintenance.py b/tests/hermes_cli/test_serve_skill_maintenance.py
index cd88fb1ae86..8411d8b5ca5 100644
--- a/tests/hermes_cli/test_serve_skill_maintenance.py
+++ b/tests/hermes_cli/test_serve_skill_maintenance.py
@@ -2,6 +2,7 @@
import asyncio
import json
from contextlib import suppress
+from queue import Queue
import pytest
@@ -61,12 +62,24 @@ async def test_serve_timer_runs_due_curator_once_and_honors_pause(tmp_path, monk
"curator:\n enabled: true\n consolidate: false\n interval_hours: 168\n"
" min_idle_hours: 0\n prune_builtins: false\n", encoding="utf-8")
from agent.curator import load_state, save_state, set_paused
- from hermes_cli.web_server_sessions import _auto_archive_ticker_loop
+ import hermes_cli.web_server_sessions as web_server_sessions
+
+ ticks = Queue()
+ original_maintenance = web_server_sessions._maybe_run_skill_maintenance
+
+ def observed_maintenance(started_at):
+ try:
+ return original_maintenance(started_at)
+ finally:
+ ticks.put(None)
+
+ monkeypatch.setattr(web_server_sessions, "_maybe_run_skill_maintenance", observed_maintenance)
save_state({"last_run_at": "2020-01-01T00:00:00+00:00", "run_count": 0, "paused": True})
- task = asyncio.create_task(_auto_archive_ticker_loop(interval_s=.02, initial_delay_s=0))
+ task = asyncio.create_task(web_server_sessions._auto_archive_ticker_loop(
+ interval_s=.02, initial_delay_s=0))
try:
- await asyncio.sleep(.15)
+ await asyncio.to_thread(ticks.get, True, 8)
assert load_state()["run_count"] == 0
# Active turns must suppress maintenance even with a zero idle threshold.
import tui_gateway.server as gateway
@@ -74,7 +87,7 @@ async def test_serve_timer_runs_due_curator_once_and_honors_pause(tmp_path, monk
gateway._sessions['maintenance-test'] = {"running": True}
set_paused(False)
try:
- await asyncio.sleep(.15)
+ await asyncio.to_thread(ticks.get, True, 8)
assert load_state()["run_count"] == 0
finally:
with gateway._sessions_lock:
diff --git a/tests/scripts/test_commit_stamp_identity.py b/tests/scripts/test_commit_stamp_identity.py
index 386e6ef2f52..4bb73882d2d 100644
--- a/tests/scripts/test_commit_stamp_identity.py
+++ b/tests/scripts/test_commit_stamp_identity.py
@@ -14,6 +14,7 @@ def test_stamp_uses_built_commit_even_with_dispatch_sha_and_refuses_mismatch(tmp
repo = tmp_path / 'repo'
repo.mkdir()
for relative in ('scripts/write_install_stamp.py', 'scripts/releases/commit_build.py',
+ 'scripts/releases/distance.py', 'scripts/releases/versioning.py',
'hermes_cli/__init__.py', 'hermes_cli/update_channel.py', 'hermes_cli/release_channels.py',
'pm/paths.py', 'pm/environments.py', 'hermes_cli/steward.py', 'hermes_constants.py'):
dest = repo / relative
diff --git a/tests/tools/test_clipboard.py b/tests/tools/test_clipboard.py
index 1fbff38c706..ce1639a36f0 100644
--- a/tests/tools/test_clipboard.py
+++ b/tests/tools/test_clipboard.py
@@ -176,13 +176,11 @@ class TestIsWsl:
def setup_method(self):
# 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 runs next.
host_runtime._wsl_detected = None
- _is_wsl.__globals__["_wsl_detected"] = None
@pytest.mark.parametrize("content, expected", [
("Linux version 5.15.0 (microsoft-standard-WSL2)", True),
@@ -192,14 +190,14 @@ class TestIsWsl:
("Linux version 6.14.0-37-generic (buildd@lcy02-amd64-049)", False),
])
def test_detection_from_proc_version(self, content, expected):
- with patch.dict(_is_wsl.__globals__, {"open": mock_open(read_data=content)}):
+ with patch.dict(host_runtime.is_wsl.__globals__, {"open": mock_open(read_data=content)}):
assert _is_wsl() is expected
def test_result_is_cached(self):
content = "Linux version 5.15.0 (microsoft-standard-WSL2)"
opener = mock_open(read_data=content)
- with patch.dict(_is_wsl.__globals__, {"open": opener}):
+ with patch.dict(host_runtime.is_wsl.__globals__, {"open": opener}):
assert _is_wsl() is True
assert _is_wsl() is True
opener.assert_called_once() # only read once