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"), (