fix(tests): patch catalog urlopen wrapper in gemini probe tests (#64318)

test_probe_sends_client_context_to_gemini and
test_probe_omits_gemini_client_context_for_other_providers (added in
b8eb89f5c) patch hermes_cli.models.urllib.request.urlopen, but
probe_api_models routes requests through the
_urlopen_model_catalog_request wrapper (open_credentialed_url from the
urllib_security hardening), so the mock is never invoked and
mock_urlopen.call_args is None -> TypeError. Every CI run on main and
every PR has been failing test slice 7/8 on these two tests.

Point the patches at _urlopen_model_catalog_request, the same target
every sibling test in TestProbeApiModelsUserAgent already uses.
89/89 tests in the file now pass.
This commit is contained in:
Teknium 2026-07-14 03:11:19 -07:00 committed by GitHub
parent 226e8de827
commit 0d3ad193d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -949,7 +949,7 @@ class TestProbeApiModelsUserAgent:
body = b'{"data":[]}'
with patch(
"hermes_cli.models.urllib.request.urlopen",
"hermes_cli.models._urlopen_model_catalog_request",
return_value=self._make_mock_response(body),
) as mock_urlopen:
probe_api_models(
@ -965,7 +965,7 @@ class TestProbeApiModelsUserAgent:
body = b'{"data":[]}'
with patch(
"hermes_cli.models.urllib.request.urlopen",
"hermes_cli.models._urlopen_model_catalog_request",
return_value=self._make_mock_response(body),
) as mock_urlopen:
probe_api_models("provider-key", "https://api.example.com/v1")