test: stub discover_local_cdp_url in CLI connect context-note test

The dual-stack discovery change made the default-local /browser connect
path call discover_local_cdp_url instead of is_browser_debug_ready, so
the old is_browser_debug_ready patch no longer short-circuited the
probe. On the CI runner nothing listens on 9222, so the test fell
through to a REAL chromium launch (which dies headless:
'The platform failed to initialize') and no context note was queued.
Patch the new discovery helper at the mixin's import site instead.
This commit is contained in:
Teknium 2026-07-18 02:39:41 -07:00
parent d93c905808
commit 4c96172d9b
1 changed files with 9 additions and 1 deletions

View File

@ -342,7 +342,15 @@ class TestChromeDebugLaunch:
cli._pending_input = Queue()
monkeypatch.delenv("BROWSER_CDP_URL", raising=False)
with patch("hermes_cli.cli_commands_mixin.is_browser_debug_ready", return_value=True), \
# The default-local path now resolves the endpoint via
# discover_local_cdp_url (dual-stack probe); patch it at the
# mixin's import site so no real network probe or browser
# launch happens on the test runner.
with patch(
"hermes_cli.cli_commands_mixin.discover_local_cdp_url",
return_value="http://127.0.0.1:9222",
), \
patch("hermes_cli.cli_commands_mixin.is_browser_debug_ready", return_value=True), \
patch("tools.browser_tool.cleanup_all_browsers"), \
patch("tools.browser_tool._ensure_cdp_supervisor"), \
redirect_stdout(StringIO()):