From a3ce23e80abd000f3f6710330546397e4dff213c Mon Sep 17 00:00:00 2001 From: Mark Philipp Date: Tue, 25 Aug 2026 10:37:54 -0700 Subject: [PATCH] test(prometheus): satisfy strict caller identity lint --- .../test_prometheus_caller_identity.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/test_litellm/integrations/test_prometheus_caller_identity.py b/tests/test_litellm/integrations/test_prometheus_caller_identity.py index b5b65049ff8..d7e747e8860 100644 --- a/tests/test_litellm/integrations/test_prometheus_caller_identity.py +++ b/tests/test_litellm/integrations/test_prometheus_caller_identity.py @@ -102,7 +102,10 @@ def test_invalid_caller_identity_mode_fails_during_prometheus_initialization( ): _set_caller_identity(monkeypatch, "invalid") - with pytest.raises(ValueError) as exc_info: + with pytest.raises( + ValueError, + match="prometheus_deployment_and_latency_caller_identity", + ) as exc_info: PrometheusLogger() message = str(exc_info.value) @@ -111,6 +114,17 @@ def test_invalid_caller_identity_mode_fails_during_prometheus_initialization( assert accepted_value in message +def test_label_resolution_rejects_non_string_class_labels(monkeypatch: pytest.MonkeyPatch): + monkeypatch.setattr( + PrometheusMetricLabels, + "litellm_deployment_total_requests", + ["api_key_alias", 1], + ) + + with pytest.raises(TypeError, match=r"Prometheus labels .* must be strings"): + PrometheusMetricLabels.get_labels("litellm_deployment_total_requests") + + @pytest.mark.parametrize( ("mode", "include_labels", "is_valid"), (