litellm/tests/proxy_unit_tests
Julio Quinteros Pro 2d41b03f8b fix(test): mock environment variables for callback validation test
The test test_proxy_config_state_post_init_callback_call was failing with:
```
ValidationError: 2 validation errors for TeamCallbackMetadata
callback_vars.langfuse_public_key
  Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]
```

Root cause: The test uses environment variable references like
"os.environ/LANGFUSE_PUBLIC_KEY" which get resolved at runtime. In
parallel execution with --dist=loadscope, these environment variables
may not be set in all worker processes, causing the resolution to
return None, which fails Pydantic validation expecting strings.

Solution: Use monkeypatch to set the required environment variables
before the test runs. This ensures consistent behavior across all
test execution environments (local, CI, parallel workers).

Fixes test failure exposed by PR #21277.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-15 20:44:17 -03:00
..
example_config_yaml fix tests 2025-10-25 10:19:24 -07:00
test_configs fix tests 2025-10-25 10:19:24 -07:00
test_model_response_typing fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
adroit-crow-413218-bc47f303efc9.json vertex testing use pathrise-convert-1606954137718 2025-01-05 14:00:17 -08:00
azure_fine_tune.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
batch_job_results_furniture.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
conftest copy.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
conftest.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
data_map.txt fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
eagle.wav fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
gettysburg.wav fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
large_text.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
messages_with_counts.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
model_cost.json fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
openai_batch_completions.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
openai_batch_completions_router.jsonl fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
speech_vertex.mp3 fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_aproxy_startup.py (Security fix) - Upgrade to fastapi==0.115.5 (#7447) 2024-12-28 17:08:19 -08:00
test_audit_logs_proxy.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_auth_checks.py tests 2026-02-13 22:01:28 -08:00
test_banned_keyword_list.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_check_responses_cost.py Add cost tracking for responses api in background mode 2025-12-19 13:35:48 +05:30
test_custom_callback_input.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_custom_logger_s3_gcs.py [Feat] Allow reading custom logger python scripts from s3 (#12623) 2025-07-16 15:07:01 -07:00
test_custom_tokenizer_bug.py fix(token-counter): extract model_info from deployment for custom_tokenizer (#15657) (#15680) 2025-10-17 19:38:45 -07:00
test_db_schema_changes.py test: initial test to enforce all functions in user_api_key_auth.py h… (#7797) 2025-01-15 21:52:45 -08:00
test_db_schema_migration.py Fix CI: Revert security scan changes and add GitGuardian ignore rules (#18358) 2025-12-22 17:03:53 -08:00
test_default_end_user_budget_simple.py [AI Gateway] - End User Budgets - Allow pointing max_end_user budget to an id, so the default ID applies to all end users (#16456) 2025-11-11 08:20:13 -08:00
test_deployed_proxy_keygen.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_e2e_pod_lock_manager.py fix: use fastuuid helper (#14903) 2025-09-25 15:47:01 -07:00
test_get_image.py fix: optimize logo fetching and resolve mcp import blockers (#19719) 2026-01-25 23:08:16 -08:00
test_google_endpoint_routing.py Support model names with slashes on Gemini endpoints (#17743) 2025-12-09 18:40:51 -08:00
test_google_gemini_proxy_request.py Fix: Send Gemini API key via x-goog-api-key header with custom api_base (#16085) 2025-11-05 07:12:13 -08:00
test_jwt.py Fix CI: Revert security scan changes and add GitGuardian ignore rules (#18358) 2025-12-22 17:03:53 -08:00
test_key_generate_dynamodb.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_key_generate_prisma.py fixing test 2026-01-16 19:06:23 -08:00
test_models_fallback_endpoint.py feat: extended /v1/models endpoint, now it returns with fallbacks on demand (#12811) 2025-07-22 23:16:46 -07:00
test_prisma_client_backoff_retry.py fix: prisma client state retries (#14925) 2025-09-25 21:54:00 -07:00
test_prompt_test_endpoint.py [Feat] UI - Prompt Management - Allow testing prompts with Chat UI (#16898) 2025-11-21 08:53:18 -08:00
test_proxy_config_unit_test.py fix: enable JSON logging via configuration and add regression test 2026-01-13 09:38:19 -07:00
test_proxy_custom_auth.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_custom_logger.py test_embedding fix 2026-01-31 13:43:53 -08:00
test_proxy_encrypt_decrypt.py test: fix test 2025-07-27 09:52:22 -07:00
test_proxy_exception_mapping.py [Perf] Embeddings: Use router's O(1) lookup and shared sessions (#16344) 2025-11-14 09:21:45 -08:00
test_proxy_gunicorn.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_pass_user_config.py fix tests 2025-10-25 10:19:24 -07:00
test_proxy_reject_logging.py [Security Bug Fix] Ensure only LLM API route fails get logged on Langfuse (and other loggers) (#12308) 2025-07-04 14:42:42 -07:00
test_proxy_routes.py test: handle wildcard routes in route validation test 2026-01-16 12:53:27 +09:00
test_proxy_server.py Fixing tests 2026-01-26 20:07:30 -08:00
test_proxy_server_caching.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_server_keys.py fix tests 2025-10-25 10:19:24 -07:00
test_proxy_server_langfuse.py (Security fix) - Upgrade to fastapi==0.115.5 (#7447) 2024-12-28 17:08:19 -08:00
test_proxy_server_spend.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_setting_guardrails.py fix(pattern_match_deployments.py): default to user input if unable to… (#6632) 2024-11-08 00:55:57 +05:30
test_proxy_token_counter.py fix mock_handler 2026-01-20 18:01:22 -08:00
test_proxy_utils.py fix(test): mock environment variables for callback validation test 2026-02-15 20:44:17 -03:00
test_realtime_cache.py [Perf] Fix bottlenecks degrading realtime endpoint performance (#16670) 2025-11-22 10:01:02 -08:00
test_response_polling_handler.py Add tests for native_background_mode feature 2026-01-27 16:48:22 -08:00
test_search_api_logging.py Add cost tracking and logging support 2025-11-25 17:14:59 +05:30
test_server_root_path.py fix: server rooth path (#19790) 2026-01-26 09:48:06 -08:00
test_skills_db.py test_create_skill_sdk 2025-12-20 15:08:31 +05:30
test_ui_path_detection.py fix: Add LITELLM_UI_PATH and LITELLM_ASSETS_PATH for read-only filesystem support (#20492) 2026-02-12 19:39:04 +05:30
test_unit_test_max_model_budget_limiter.py fix conflicts with main- (this PR is from upstream/main) 2026-02-07 03:10:53 +05:30
test_unit_test_proxy_hooks.py [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
test_update_spend.py [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
test_user_api_key_auth.py Fix CI: Revert security scan changes and add GitGuardian ignore rules (#18358) 2025-12-22 17:03:53 -08:00
test_zero_cost_model_budget_bypass.py Add support for 0 cost models 2026-02-02 13:29:37 +05:30
vertex_key.json ci/cd update vertex acct 2025-01-05 13:43:32 -08:00