From 4ec3750fb99a2235dd0f47ec3e8a4701e62180c9 Mon Sep 17 00:00:00 2001 From: yucheng Date: Mon, 2 Nov 2026 14:44:12 -0800 Subject: [PATCH] test(proxy): keep only the raising call inside pytest.raises --- .../test_pass_through_endpoints.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py b/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py index 6d22cb8f739..492d0d9c4c2 100644 --- a/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py +++ b/tests/unit/proxy/pass_through_endpoints/test_pass_through_endpoints.py @@ -532,15 +532,15 @@ async def test_guardrail_proxy_exception_carries_the_guardrails_that_ran(): patch( # test-quality-ok: proxy_logging_obj is a proxy_server module global read inside pass_through_request "litellm.proxy.proxy_server.proxy_logging_obj", ProxyLogging(user_api_key_cache=DualCache()) ), - pytest.raises(ProxyException) as exc, ): litellm_patch.setattr(litellm, "callbacks", [guardrail]) - await pass_through_request( - request=mock_request, - target="http://test.com/v1/chat/completions", - custom_headers={}, - user_api_key_dict=UserAPIKeyAuth(api_key="sk-test"), - ) + with pytest.raises(ProxyException) as exc: + await pass_through_request( + request=mock_request, + target="http://test.com/v1/chat/completions", + custom_headers={}, + user_api_key_dict=UserAPIKeyAuth(api_key="sk-test"), + ) assert exc.value.headers["x-litellm-applied-guardrails"] == "passed-guard"