test(prometheus): satisfy strict caller identity lint

This commit is contained in:
Mark Philipp 2026-08-25 10:37:54 -07:00
parent 8d0c23ea64
commit a3ce23e80a

View file

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