From 12a3f972f259560a7bb75895607daab7b063a315 Mon Sep 17 00:00:00 2001 From: yassin Date: Thu, 27 Aug 2026 01:36:37 +0000 Subject: [PATCH] test(alerting): use specific ValidationError matches in config rejection test Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../integrations/SlackAlerting/test_user_spend_alerts.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_litellm/integrations/SlackAlerting/test_user_spend_alerts.py b/tests/test_litellm/integrations/SlackAlerting/test_user_spend_alerts.py index eaac300ec81..28f5d0bf7a2 100644 --- a/tests/test_litellm/integrations/SlackAlerting/test_user_spend_alerts.py +++ b/tests/test_litellm/integrations/SlackAlerting/test_user_spend_alerts.py @@ -3,6 +3,7 @@ from typing import Final from unittest.mock import AsyncMock, patch import pytest +from pydantic import ValidationError from litellm.integrations.SlackAlerting.slack_alerting import SlackAlerting from litellm.integrations.SlackAlerting.user_spend_alerts import ( @@ -120,11 +121,11 @@ def test_anomalies_not_in_default_alert_types(): def test_invalid_config_rejected(): - with pytest.raises(ValueError): + with pytest.raises(ValidationError, match="daily_spend_per_user_threshold"): SlackAlertingArgs(daily_spend_per_user_threshold=0) - with pytest.raises(ValueError): + with pytest.raises(ValidationError, match="spend_anomaly_baseline_days"): SlackAlertingArgs(spend_anomaly_baseline_days=0) - with pytest.raises(ValueError): + with pytest.raises(ValidationError, match="user_spend_check_interval"): SlackAlertingArgs(user_spend_check_interval=10)