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 <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-07-17 19:10:44 +00:00
parent 7015bd2ea1
commit a8e243e07e
No known key found for this signature in database

View file

@ -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"