Fix router test isolation for xdist and rebalance proxy unit tests
Router tests: expand conftest save/restore to cover all globals mutated by router tests (default_fallbacks, tag_budget_config, request_timeout, enable_azure_ad_token_refresh, num_retries_per_request, model_cost, token_counter). These were leaking across xdist workers. Proxy tests: move test_proxy_utils.py (169 parametrized) and test_proxy_server.py (72 parametrized) from part2 to part1, balancing ~370 vs ~360 tests (was ~129 vs ~600). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
74e57bdd27
commit
1a00dd4dbb
@ -1008,12 +1008,11 @@ jobs:
|
||||
./docker/entrypoint.sh
|
||||
set -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: |
|
||||
pwd
|
||||
ls
|
||||
# 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 -v
|
||||
no_output_timeout: 15m
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
@ -1109,7 +1108,7 @@ jobs:
|
||||
command: |
|
||||
pwd
|
||||
ls
|
||||
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 -v
|
||||
no_output_timeout: 15m
|
||||
- store_test_results:
|
||||
path: test-results
|
||||
|
||||
@ -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)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user