test(router): cover the retry skip-list narrowing helper

The router code coverage gate reads every function defined in router.py
and fails when no test file names it. _as_retry_skipped_deployment_ids
was only reached indirectly through the retry path, so the gate went red
on this PR's tip.

Test it directly instead: a tuple of strings survives, non-string items
inside the tuple are dropped, and every other shape a caller could send
narrows to an empty skip list.
This commit is contained in:
mateo-berri 2026-09-06 00:06:35 -07:00
parent 6866eac96f
commit 0fcf0fe06c

View file

@ -13277,6 +13277,26 @@ def test_router_deployment_ids_to_skip_on_retry(status_code, failed_deployment_i
assert litellm.Router._deployment_ids_to_skip_on_retry(exception, already_skipped) == expected
@pytest.mark.parametrize(
"value,expected",
[
(("first", "second"), ("first", "second")),
((), ()),
(("first", 7, None, "second"), ("first", "second")),
(None, ()),
(7, ()),
("first", ()),
(["first"], ()),
({"first": True}, ()),
(object(), ()),
],
)
def test_router_as_retry_skipped_deployment_ids_keeps_only_a_tuple_of_strings(value, expected):
from litellm.router import _as_retry_skipped_deployment_ids
assert _as_retry_skipped_deployment_ids(value) == expected
@pytest.mark.parametrize(
"deployment_ids,skipped,expected",
[