From ea12510f1a5799e7d9fd2cf87bd5c94263440f46 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:20:42 -0700 Subject: [PATCH 1/2] test(router): drop duplicate get_configured_mode test failing ruff F811 PRs #39630 and #39634 both added test_get_configured_mode_reads_deployment_model_info to tests/test_litellm/test_router.py, so the staging tip defines it twice and the required lint check fails with F811 on every PR synced past 321636ef5d. Keep the four tests from #39634 (mode read, None for unset or unknown, no wildcard pattern routing, malformed values treated as absent), which subsume the #39630 pair, and delete that pair. Five hand-applied mutations of Router.get_configured_mode are all still killed by the surviving tests. --- tests/test_litellm/test_router.py | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py index e4236afc586..417c58b95f6 100644 --- a/tests/test_litellm/test_router.py +++ b/tests/test_litellm/test_router.py @@ -12701,33 +12701,3 @@ async def test_prompt_management_factory_marks_injection_for_every_deployment(mo bucket = captured.get("litellm_metadata") or captured["metadata"] assert captured["model_info"]["id"] == "provisional-dep" assert bucket["litellm_gateway_injected_cache"] == "" - - -def test_get_configured_mode_reads_deployment_model_info(): - router = Router( - model_list=[ - { - "model_name": "my-tts", - "litellm_params": {"model": "openai/some-unmapped-mode-model"}, - "model_info": {"mode": "audio_speech"}, - } - ] - ) - - assert router.get_configured_mode("my-tts") == "audio_speech" - - -@pytest.mark.parametrize("model_info", [{}, {"mode": ""}, {"mode": " "}, {"mode": 123}]) -def test_get_configured_mode_returns_none_for_unset_blank_or_unknown(model_info): - router = Router( - model_list=[ - { - "model_name": "plain-model", - "litellm_params": {"model": "openai/some-unmapped-mode-model"}, - "model_info": model_info, - } - ] - ) - - assert router.get_configured_mode("plain-model") is None - assert router.get_configured_mode("unknown-model") is None From 1d71e306cc13008f551d8964623ca813ca44bccb Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Thu, 3 Sep 2026 15:38:15 -0700 Subject: [PATCH 2/2] test(router): assert a non-chat configured mode round-trips With every kept get_configured_mode test using mode "chat", a Router that answered "chat" for any non-blank configured mode passed all four of them (the deleted #39630 pair's audio_speech case was the only test catching it). Read the mode back as audio_speech on an unmapped model so the configured value itself is what the test checks. Six hand-applied mutations of Router.get_configured_mode, including that hardcoded-chat one, are now all killed by the four surviving tests. --- tests/test_litellm/test_router.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.py index 417c58b95f6..228588d974f 100644 --- a/tests/test_litellm/test_router.py +++ b/tests/test_litellm/test_router.py @@ -7362,14 +7362,14 @@ def test_get_configured_mode_reads_deployment_model_info(): router = litellm.Router( model_list=[ { - "model_name": "chat-model", - "litellm_params": {"model": "openai/some-unmapped-model"}, - "model_info": {"mode": "chat"}, + "model_name": "tts-model", + "litellm_params": {"model": "openai/some-unmapped-tts-model"}, + "model_info": {"mode": "audio_speech"}, } ] ) - assert router.get_configured_mode("chat-model") == "chat" + assert router.get_configured_mode("tts-model") == "audio_speech" def test_get_configured_mode_returns_none_for_unset_or_unknown():