The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix router test isolation for xdist and rebalance proxy unit tests
yuneng-jiang1a00dd4dbbc6
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex 78a701319ed..617a8cb3ae6 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -1008,12 +1008,11 @@ jobs:./docker/entrypoint.shset -e- run:- name: Run proxy unit tests (part 1 - auth checks only, key generation in separate job)+ name: Run proxy unit tests (part 1 - auth checks + proxy_utils + proxy_server)command: |pwdls- # Run auth tests with parallel execution (test_key_generate_prisma moved to separate job to avoid event loop issues)- python -m pytest tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py --junitxml=test-results/junit-part1.xml --durations=10 -n 8 --timeout=300 -v+ python -m pytest tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py tests/proxy_unit_tests/test_proxy_utils.py tests/proxy_unit_tests/test_proxy_server.py --junitxml=test-results/junit-part1.xml --durations=10 -n 8 --timeout=300 -vno_output_timeout: 15m- store_test_results:path: test-results@@ -1109,7 +1108,7 @@ jobs:command: |pwdls- python -m pytest tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py --junitxml=test-results/junit-part2.xml --durations=10 -n 8 --timeout=300 -v+ python -m pytest tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py --ignore=tests/proxy_unit_tests/test_proxy_utils.py --ignore=tests/proxy_unit_tests/test_proxy_server.py --junitxml=test-results/junit-part2.xml --durations=10 -n 8 --timeout=300 -vno_output_timeout: 15m- store_test_results:path: test-resultsdiff --git a/tests/local_testing/conftest.py b/tests/local_testing/conftest.pyindex 71cfec4157b..b858154e2fb 100644--- a/tests/local_testing/conftest.py+++ b/tests/local_testing/conftest.py@@ -39,7 +39,18 @@ def isolate_litellm_state():original_state[attr] = val.copy() if val else []# Save other globals that tests commonly mutate- for attr in ("set_verbose", "cache", "num_retries"):+ for attr in (+ "set_verbose",+ "cache",+ "num_retries",+ "num_retries_per_request",+ "request_timeout",+ "default_fallbacks",+ "enable_azure_ad_token_refresh",+ "tag_budget_config",+ "model_cost",+ "token_counter",+ ):if hasattr(litellm, attr):original_state[attr] = getattr(litellm, attr)