From 5fdd9f6d3a8c5873433ca5bf96b1652e784a4bea Mon Sep 17 00:00:00 2001 From: "Brian D. Evans" <252620095+briandevans@users.noreply.github.com> Date: Fri, 24 Apr 2026 09:40:06 -0700 Subject: [PATCH] test(model-switch): assert fetch_api_models kwargs match current signature (#15243) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``_model_flow_named_custom`` was extended in ``647900e8`` to pass ``api_mode`` through to ``fetch_api_models`` so anthropic-messages and Cloudflare-protected endpoints validate correctly. The test that pins "we must still probe the endpoint when a model is already saved" kept asserting the pre-647900e8 kwarg shape and has been failing on every PR's CI since — one of the four standing baseline failures I've been flagging on open PRs (#15158, #15162, #15173, #15185, #15244). The production call is: fetch_api_models(api_key, base_url, timeout=8.0, api_mode=api_mode or None) where ``api_mode`` comes from ``provider_info.get("api_mode", "")``. The test fixture has no ``api_mode`` entry so ``api_mode or None`` resolves to ``None``. One-line fix — add ``api_mode=None`` to the ``assert_called_once_with``. Added an inline comment pointing at the 647900e8 history so future contributors immediately see why the kwarg exists and don't accidentally strip it. All 6 tests in the class still pass locally. This should clear the corresponding entry from the baseline failure set on every open PR's ``test`` lane. Closes #15243 Co-Authored-By: Claude Opus 4.7 (1M context) --- tests/hermes_cli/test_custom_provider_model_switch.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/hermes_cli/test_custom_provider_model_switch.py b/tests/hermes_cli/test_custom_provider_model_switch.py index a0123670be916..d496be8bc832c 100644 --- a/tests/hermes_cli/test_custom_provider_model_switch.py +++ b/tests/hermes_cli/test_custom_provider_model_switch.py @@ -51,8 +51,14 @@ def test_saved_model_still_probes_endpoint(self, config_home): patch("builtins.print"): _model_flow_named_custom({}, provider_info) - # fetch_api_models MUST be called even though model was saved - mock_fetch.assert_called_once_with("sk-test", "https://vllm.example.com/v1", timeout=8.0) + # fetch_api_models MUST be called even though model was saved. + # ``api_mode`` was added to the production signature by 647900e8 + # ("fix(cli): support model validation for anthropic_messages and + # cloudflare-protected endpoints") — the test fixture has no + # ``api_mode`` entry so ``api_mode or None`` resolves to ``None``. + mock_fetch.assert_called_once_with( + "sk-test", "https://vllm.example.com/v1", timeout=8.0, api_mode=None, + ) def test_can_switch_to_different_model(self, config_home): """User selects a different model than the saved one."""