Skip to content

The agent that grows with you

fix some bundle issues

ethernetacb82a62d050
diff --git a/tests/agent/test_run_agent.py b/tests/agent/test_run_agent.py
index 2451585aa0e..255b998ec61 100644
--- a/tests/agent/test_run_agent.py
+++ b/tests/agent/test_run_agent.py
@@ -55,6 +55,13 @@ def test_is_destructive_command_treats_cp_as_mutating():
[email protected](autouse=True)
+def _mock_plugin_discovery(monkeypatch):
+ # Tool definitions are supplied by these unit fixtures. Scanning every
+ # bundled plugin again for each isolated test home adds no coverage.
+ monkeypatch.setattr("hermes_cli.plugins.discover_plugins", lambda: None)
+
+
@pytest.fixture()
def agent():
"""Minimal AIAgent with mocked OpenAI client and tool loading."""
@@ -6812,7 +6819,7 @@ class TestAnthropicInterruptHandler:
"""_interruptible_api_call must handle Anthropic mode when interrupted."""
- def test_interruptible_anthropic_interrupt_never_closes_shared_client(self):
+ def test_interruptible_anthropic_interrupt_never_closes_shared_client(self, agent):
"""#67142: a non-streaming Anthropic interrupt must abort the
request-local client from the poll thread, never close/rebuild the
shared _anthropic_client (which raced a live SSL BIO and corrupted an
@@ -6823,18 +6830,8 @@ class TestAnthropicInterruptHandler:
"""
import time
from unittest.mock import MagicMock
- from run_agent import AIAgent
from agent.chat_completion_helpers import interruptible_api_call
- agent = AIAgent(
- api_key="test-key",
- base_url="https://api.anthropic.com",
- provider="anthropic",
- model="claude-test",
- quiet_mode=True,
- skip_context_files=True,
- skip_memory=True,
- )
agent.api_mode = "anthropic_messages"
agent._interrupt_requested = False
agent._anthropic_client = MagicMock()
diff --git a/tests/tools/test_code_execution_windows_env.py b/tests/tools/test_code_execution_windows_env.py
index 0dc5fb21dc1..01e7891d244 100644
--- a/tests/tools/test_code_execution_windows_env.py
+++ b/tests/tools/test_code_execution_windows_env.py
@@ -206,19 +206,30 @@ def test_windows_live_child_offset_matches_os_zone_when_timezone_is_configured(m
"""The user-visible contract of #112233: with ``timezone:`` configured, a real Windows child
must report the OS zone's UTC offset — an IANA name in ``TZ`` made the MSVC runtime derive
``time.timezone == 0`` (+01:00 instead of -07:00) while ``time.tzname`` still read correctly."""
- import datetime
import json
monkeypatch.setattr("hermes_time.get_timezone_name", lambda: "America/Los_Angeles")
child_env = _configured_timezone_child_env()
- result = subprocess.run(
- [sys.executable, "-c",
- "import json, time, datetime; print(json.dumps([time.timezone, "
- "datetime.datetime.now().astimezone().utcoffset().total_seconds()]))"],
- env=child_env, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=30,
+ assert "TZ" not in child_env
+
+ # The runner starts Python with TZ=UTC; its cached timezone is not the OS zone.
+ # Query a fresh control process with TZ removed, independently of the builder.
+ control_env = os.environ.copy()
+ control_env.pop("TZ", None)
+ timestamp = str(time.time()) # Both children observe the same instant across DST changes.
+ script = (
+ "import datetime, json, sys, time; "
+ "instant = datetime.datetime.fromtimestamp(float(sys.argv[1]), datetime.timezone.utc); "
+ "print(json.dumps([time.timezone, instant.astimezone().utcoffset().total_seconds()]))"
)
- assert result.returncode == 0, result.stderr
- child_timezone, child_offset = json.loads(result.stdout.strip())
- # The test process itself has no TZ override, so its view IS the OS zone.
- assert child_offset == datetime.datetime.now().astimezone().utcoffset().total_seconds()
- assert child_timezone == time.timezone
+
+ def read_timezone(env):
+ result = subprocess.run(
+ [sys.executable, "-c", script, timestamp],
+ env=env, stdin=subprocess.DEVNULL, capture_output=True,
+ text=True, encoding="utf-8", errors="replace", timeout=30,
+ )
+ assert result.returncode == 0, result.stderr
+ return json.loads(result.stdout)
+
+ assert read_timezone(child_env) == read_timezone(control_env)