From adfe63cf3a2dab5c475bc790bff40b7dac39f744 Mon Sep 17 00:00:00 2001 From: Cole McIntosh <82463175+colesmcintosh@users.noreply.github.com> Date: Thu, 3 Jul 2025 14:28:46 -0700 Subject: [PATCH] fix: handle proxy internal callbacks in callback management test (#12294) The test_list_callbacks_mixed_callback_types test was failing when run in parallel with other tests due to the proxy server's internal _PROXY_VirtualKeyModelMaxBudgetLimiter callback persisting across test runs. This fix filters out proxy internal callbacks from the test assertions to ensure consistent test behavior regardless of test execution order or parallelization. --- .../test_callback_management_endpoints.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py index 7e6c1b4233e..5990af595df 100644 --- a/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py +++ b/tests/test_litellm/proxy/management_endpoints/test_callback_management_endpoints.py @@ -169,6 +169,15 @@ class TestCallbackManagementEndpoints: response_data = response.json() + # Filter out any proxy-specific callbacks that might be present from parallel test runs + # These are internal callbacks that can persist when tests run in parallel + proxy_internal_callbacks = ["_PROXY_VirtualKeyModelMaxBudgetLimiter"] + + response_data["success_and_failure"] = [ + cb for cb in response_data["success_and_failure"] + if cb not in proxy_internal_callbacks + ] + # Verify callbacks are properly categorized assert "prometheus" in response_data["success_and_failure"] # callbacks list items go to success_and_failure assert "langfuse" in response_data["success"]