diff --git a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py index 4f513277f7e..d7579097bdb 100644 --- a/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py +++ b/tests/test_litellm/proxy/guardrails/guardrail_hooks/content_filter/test_content_filter.py @@ -115,7 +115,8 @@ class TestContentFilterGuardrail: assert result["texts"] == ["Call <> about <>"] finally: - litellm.callbacks.remove(guardrail) + if guardrail in litellm.callbacks: + litellm.callbacks.remove(guardrail) def test_check_patterns_ssn(self): """