From a8e243e07e2fbd496e123e50c4b164bfa64c2fe0 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 17 Jul 2026 19:10:44 +0000 Subject: [PATCH] test(pricing): force the local cost map when asserting gpt-realtime-mini mode test_get_model_info_reports_realtime_mode called get_model_info, which by default fetches model_prices_and_context_window.json from GitHub's main branch. The mode=realtime change from #33728 lives on the internal staging branch but has not landed on main yet, so CI fetched the stale 'chat' mode and the assertion flipped, breaking the Unit Tests: MCP, Secrets, Containers & Misc job on every open PR. Point the assertion at the bundled backup JSON by forcing the local cost map flag on and rebinding model_cost, matching the pattern used by the realtime transcription tests in test_cost_calculator.py. Clear the get_model_info lru_cache so a prior remote-backed call in the same worker can not leak through. Co-authored-by: Krrish Dholakia --- tests/test_litellm/test_gpt_realtime_mode.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/test_gpt_realtime_mode.py b/tests/test_litellm/test_gpt_realtime_mode.py index 80cb3cc85f0..ce9ef896fa8 100644 --- a/tests/test_litellm/test_gpt_realtime_mode.py +++ b/tests/test_litellm/test_gpt_realtime_mode.py @@ -68,7 +68,10 @@ def test_realtime_only_gpt_4o_models_are_mode_realtime(model): assert _load_cost_map()[model]["mode"] == "realtime" -def test_get_model_info_reports_realtime_mode(): +def test_get_model_info_reports_realtime_mode(monkeypatch): + monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True") # pragma: allowlist secret + monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url="")) + litellm.get_model_info.cache_clear() assert litellm.get_model_info("gpt-realtime-mini")["mode"] == "realtime"