fix(tests): patch the catalog-request seam in gemini probe UA tests - #64200
fix(tests): patch the catalog-request seam in gemini probe UA tests#64200Soju06 wants to merge 1 commit into
Conversation
test_probe_sends_client_context_to_gemini and test_probe_omits_gemini_client_context_for_other_providers patch hermes_cli.models.urllib.request.urlopen, but probe_api_models routes requests through open_credentialed_url's OpenerDirector, which never calls the module-level urlopen. The mock is never hit, the request escapes to the real network, and mock_urlopen.call_args is None — 'NoneType' object is not subscriptable on every CI run since the tests landed. Patch _urlopen_model_catalog_request instead, the same seam every neighboring test in this class uses.
4735087 to
dddca68
Compare
|
Thanks @Soju06 — you submitted this fix first (~3h before ours), and your diagnosis was exactly right: the probe requests go through the Our duplicate-PR sweep unfortunately missed this before we shipped the identical repoint in #64318 (merged as 0d3ad19) to unblock CI, which was red on every run. Apologies that the fixes crossed — credit for the first correct diagnosis and fix is yours. Closing since the test change is now redundant on main. The |
Problem
mainCI is currently red:tests/hermes_cli/test_model_validation.py::TestProbeApiModelsUserAgent::test_probe_sends_client_context_to_geminiand::test_probe_omits_gemini_client_context_for_other_providers(added in b8eb89f) fail on every run with:The tests patch
hermes_cli.models.urllib.request.urlopen, butprobe_api_modelssends catalog requests throughopen_credentialed_url, which opens via anOpenerDirector(opener.open(...)) and never calls the module-levelurlopen. The mock is never invoked, the request escapes to the real network (and fails in CI), andmock_urlopen.call_argsisNone.This also fails every open PR's "All required checks pass" gate, since the merge ref inherits the broken tests.
Change
Patch
hermes_cli.models._urlopen_model_catalog_requestinstead — the same seam every neighboring test in this class already uses. Assertions unchanged; the header behavior under test (X-goog-api-clientpresent for the official Gemini endpoint, absent otherwise) passes once the mock actually intercepts.Test-only change.
Tests
tests/hermes_cli/test_model_validation.py+tests/agent/test_gemini_native_adapter.py+tests/tools/test_tts_gemini.py: 139 passed.🤖 Generated with Claude Code