From a76b59db9ff2bf71b8981c33c62bddadffbc76f6 Mon Sep 17 00:00:00 2001 From: "devin-ai-integration[bot]" <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 1 Oct 2026 18:23:31 +0000 Subject: [PATCH] test(proxy): move middleware, spend_tracking, pass_through, common_utils and root proxy tests into tests/unit/proxy (#44015) Co-authored-by: yuneng Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/test-unit.yml | 102 ++++++++++- CONTRIBUTING.md | 2 +- Makefile | 83 ++++++++- scripts/test_tool_allowlist_script.py | 4 +- .../SPEND_TRACKING_COVERAGE_MATRIX.md | 2 +- tests/test_spend_logs.py | 4 +- .../common_utils/html_forms}/__init__.py | 0 .../html_forms/test_native_client_consent.py | 0 .../common_utils/html_forms/test_ui_login.py | 0 .../proxy/common_utils/test_admin_ui_utils.py | 0 .../test_auth_cache_invalidation_pubsub.py | 0 .../proxy/common_utils/test_cache_codec.py | 0 .../test_callback_config_validation.py | 0 .../proxy/common_utils/test_callback_utils.py | 0 .../common_utils/test_config_sync_pubsub.py | 0 .../common_utils/test_custom_openapi_spec.py | 0 .../proxy/common_utils/test_debug_utils.py | 0 .../test_discoverable_model_filter.py | 0 .../test_encrypt_decrypt_utils.py | 0 .../common_utils/test_error_body_call_id.py | 0 ..._expired_ui_session_key_cleanup_manager.py | 0 .../proxy/common_utils/test_get_routes.py | 0 .../common_utils/test_http_parsing_utils.py | 0 .../common_utils/test_json_merge_patch.py | 0 .../common_utils/test_key_rotation_e2e.py | 0 .../test_key_rotation_integration.py | 0 .../common_utils/test_key_rotation_lock.py | 0 .../common_utils/test_key_rotation_manager.py | 0 .../common_utils/test_load_config_utils.py | 0 .../common_utils/test_model_deprecation.py | 0 .../common_utils/test_model_listing_utils.py | 0 .../test_openai_endpoint_utils.py | 0 .../common_utils/test_openai_error_payload.py | 0 .../proxy/common_utils/test_path_utils.py | 0 .../test_periodic_reload_schedule.py | 0 .../common_utils/test_prompt_cache_pricing.py | 0 .../proxy/common_utils/test_rbac_utils.py | 0 .../test_registry_read_through.py | 0 .../common_utils/test_reset_budget_job.py | 0 .../test_scheduled_job_stagger.py | 0 .../proxy/common_utils/test_sse_keepalive.py | 0 .../common_utils/test_static_asset_utils.py | 0 .../proxy/common_utils/test_swagger_utils.py | 0 .../proxy/common_utils/test_timezone_utils.py | 0 .../test_upsert_budget_membership.py | 0 .../common_utils/test_user_api_key_cache.py | 0 tests/unit/proxy/conftest.py | 171 +++++++++++++++++- .../proxy/enterprise_billing}/__init__.py | 0 .../test_billing_metrics.py | 0 tests/unit/proxy/experimental/__init__.py | 0 .../proxy/experimental/mcp_server/__init__.py | 0 .../mcp_server/test_tool_registry.py | 2 +- .../health_endpoints/test_health_endpoints.py | 2 +- .../unit/proxy/logging_endpoints/__init__.py | 0 .../test_callback_logs_endpoints.py | 0 .../test_admission_control_middleware.py | 0 ...est_billable_request_metrics_middleware.py | 0 ...t_budget_reservation_release_middleware.py | 0 .../test_in_flight_requests_middleware.py | 0 .../test_per_request_root_path_middleware.py | 0 .../test_prometheus_auth_middleware.py | 0 .../test_prometheus_auth_middleware_asgi.py | 0 .../test_security_headers_middleware.py | 0 .../proxy/pass_through_endpoints/__init__.py | 0 .../llm_provider_handlers/__init__.py | 0 ...t_anthropic_passthrough_logging_handler.py | 0 ...zure_speech_passthrough_logging_handler.py | 0 .../test_batch_attribution.py | 0 ...test_cohere_passthrough_logging_handler.py | 0 ...end_medical_passthrough_logging_handler.py | 0 ...test_cursor_passthrough_logging_handler.py | 0 ...gram_listen_passthrough_logging_handler.py | 0 ...test_fal_ai_passthrough_logging_handler.py | 0 ...test_gemini_passthrough_logging_handler.py | 0 ...test_openai_passthrough_logging_handler.py | 0 ...st_tinyfish_passthrough_logging_handler.py | 0 ..._transcribe_passthrough_logging_handler.py | 0 ...st_typesafe_passthrough_logging_handler.py | 0 .../test_carry_guardrail_logging_info.py | 0 .../test_deepgram_ws_passthrough_routes.py | 0 .../test_llm_pass_through_endpoints.py | 0 .../test_managed_id_rewriter.py | 0 .../test_method_specific_routing.py | 0 .../test_passthrough_auth_default.py | 0 .../test_passthrough_endpoint_router.py | 0 ...test_passthrough_endpoints_common_utils.py | 0 ...t_passthrough_guardrail_block_otel_span.py | 0 .../test_passthrough_guardrails.py | 0 ..._passthrough_guardrails_field_targeting.py | 0 .../test_passthrough_post_call_guardrails.py | 0 .../test_streaming_handler.py | 0 .../test_streaming_handler_interrupt.py | 0 .../test_upstream_usage_headers.py | 0 .../test_vertex_ai_batch_passthrough.py | 0 .../test_vertex_passthrough_load_balancing.py | 0 .../test_watsonx_proxy_route.py | 0 .../test_baseline_accounting.py | 0 .../spend_tracking/test_budget_reservation.py | 0 .../test_budget_reservation_redis_failure.py | 0 .../test_carried_budget_state.py | 0 .../test_cloudzero_endpoints.py | 0 .../test_compression_savings.py | 0 .../proxy/spend_tracking/test_input_tokens.py | 0 .../test_key_metadata_recovery.py | 0 .../spend_tracking/test_ptu_feature_flag.py | 0 .../test_ptu_flat_cost_rollup.py | 0 .../proxy/spend_tracking/test_savings.py | 0 .../spend_tracking/test_spend_capture_rate.py | 0 .../test_spend_counter_batch.py | 0 .../proxy/spend_tracking/test_spend_event.py | 0 .../test_spend_event_producer.py | 0 .../test_spend_log_error_logger.py | 0 .../test_spend_management_endpoints.py | 0 .../test_spend_query_optimization.py | 0 .../test_spend_tracking_utils.py | 0 .../proxy/test__types.py | 0 .../proxy/test_aiohttp_cleanup_closed.py | 0 .../proxy/test_aiohttp_session_recovery.py | 0 .../proxy/test_api_key_masking_in_errors.py | 0 .../test_audio_speech_prometheus_hooks.py | 2 +- .../proxy/test_batch_expiry.py | 0 .../proxy/test_batch_metadata_none_fix.py | 0 .../proxy/test_batch_retrieve_bedrock.py | 0 .../test_batch_x_litellm_model_encoding.py | 0 .../proxy/test_blocked_response_usage.py | 0 .../test_body_snapshot_callback_params.py | 0 .../proxy/test_budget_reservation.py | 0 .../proxy/test_bug_report_config.py | 0 .../proxy/test_caching_routes.py | 0 .../proxy/test_chat_completion_metadata.py | 0 .../proxy/test_claude_code_marketplace.py | 0 .../proxy/test_collector.py | 0 .../proxy/test_common_request_processing.py | 0 .../proxy/test_component_allowlists.py | 0 .../test_config_hosted_vllm_embedding.yaml} | 0 .../proxy/test_conftest.py | 0 .../proxy/test_cors_config.py | 0 .../proxy/test_custom_proxy.py | 0 .../proxy/test_dynamic_mcp_route.py | 0 .../proxy/test_empty_model_list.py | 0 .../proxy/test_enforce_user_param.py | 2 +- .../test_fallback_management_endpoints.py | 0 .../proxy/test_fastapi_offline_routes.py | 0 ...test_filter_models_by_team_access_group.py | 0 .../proxy/test_health_check_functions.py | 0 .../proxy/test_health_check_max_tokens.py | 0 .../proxy/test_init_litellm_callbacks.py | 0 .../test_langfuse_passthrough_security.py | 0 .../proxy/test_lazy_openapi_snapshot.py | 0 .../proxy/test_litellm_pre_call_utils.py | 0 .../proxy/test_max_budget_env_var.py | 0 .../proxy/test_mcp_asgi_response.py | 0 .../test_model_based_routing_files_batches.py | 0 .../proxy/test_model_deprecations_endpoint.py | 0 .../test_model_dump_with_preserved_fields.py | 0 .../proxy/test_model_id_header_propagation.py | 0 .../proxy/test_model_info_default_limits.py | 0 .../proxy/test_model_level_guardrails.py | 0 .../proxy/test_model_list_aliases.py | 0 .../proxy/test_model_list_callback_filter.py | 0 .../proxy/test_model_list_discoverable.py | 0 .../proxy/test_model_list_healthy_only.py | 0 ...t_modify_response_streaming_passthrough.py | 0 .../proxy/test_native_compaction.py | 0 .../test_openai_ws_passthrough_routes.py | 0 .../proxy/test_openapi_schema_validation.py | 0 .../proxy/test_plugin_routes.py | 0 .../proxy/test_pointfive_dashboard_config.py | 0 .../proxy/test_pointfive_ui_callback.py | 0 .../proxy/test_pricing_field_strip.py | 0 .../proxy/test_prisma_engine_watchdog.py | 0 .../proxy/test_prisma_migration.py | 0 .../proxy/test_prometheus_cleanup.py | 0 .../proxy/test_prometheus_metrics_server.py | 0 .../test_provider_url_destination_guard.py | 0 .../proxy/test_proxy_cli.py | 10 +- .../test_proxy_logging_hook_detection.py | 0 .../proxy/test_proxy_types.py | 0 .../proxy/test_pyroscope.py | 0 .../proxy/test_read_model_list.py | 0 .../proxy/test_redis_auth_cache_flag.py | 2 + .../proxy/test_response_model_sanitization.py | 0 .../proxy/test_route_a2a_models.py | 0 .../proxy/test_route_llm_request.py | 0 .../proxy/test_route_priority.py | 0 .../proxy/test_sensitive_route_auth.py | 0 .../proxy/test_shared_health_check.py | 0 .../proxy/test_spend_log_cleanup.py | 0 .../proxy/test_swagger_chat_completions.py | 0 .../proxy/test_team_member_update.py | 0 .../proxy/test_team_org_move.py | 0 .../proxy/test_tools_allowlist_enforcement.py | 0 .../proxy/test_tracing_endpoints.py | 0 .../test_update_llm_router_resilience.py | 0 .../proxy/test_zerobus_dashboard_config.py | 0 tests/unit/proxy/types_utils/__init__.py | 0 .../test_db_overlay_remote_module_scrub.py | 0 .../test_get_instance_fn_runtime_gate.py | 0 198 files changed, 363 insertions(+), 25 deletions(-) rename tests/{test_litellm/proxy/logging_endpoints => unit/proxy/common_utils/html_forms}/__init__.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/html_forms/test_native_client_consent.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/html_forms/test_ui_login.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_admin_ui_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_auth_cache_invalidation_pubsub.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_cache_codec.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_callback_config_validation.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_callback_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_config_sync_pubsub.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_custom_openapi_spec.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_debug_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_discoverable_model_filter.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_encrypt_decrypt_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_error_body_call_id.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_get_routes.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_http_parsing_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_json_merge_patch.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_key_rotation_e2e.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_key_rotation_integration.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_key_rotation_lock.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_key_rotation_manager.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_load_config_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_model_deprecation.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_model_listing_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_openai_endpoint_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_openai_error_payload.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_path_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_periodic_reload_schedule.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_prompt_cache_pricing.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_rbac_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_registry_read_through.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_reset_budget_job.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_scheduled_job_stagger.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_sse_keepalive.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_static_asset_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_swagger_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_timezone_utils.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_upsert_budget_membership.py (100%) rename tests/{test_litellm => unit}/proxy/common_utils/test_user_api_key_cache.py (100%) rename tests/{test_litellm/proxy/types_utils => unit/proxy/enterprise_billing}/__init__.py (100%) rename tests/{test_litellm => unit}/proxy/enterprise_billing/test_billing_metrics.py (100%) create mode 100644 tests/unit/proxy/experimental/__init__.py create mode 100644 tests/unit/proxy/experimental/mcp_server/__init__.py rename tests/{test_litellm => unit}/proxy/experimental/mcp_server/test_tool_registry.py (95%) create mode 100644 tests/unit/proxy/logging_endpoints/__init__.py rename tests/{test_litellm => unit}/proxy/logging_endpoints/test_callback_logs_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_admission_control_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_billable_request_metrics_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_budget_reservation_release_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_in_flight_requests_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_per_request_root_path_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_prometheus_auth_middleware.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_prometheus_auth_middleware_asgi.py (100%) rename tests/{test_litellm => unit}/proxy/middleware/test_security_headers_middleware.py (100%) create mode 100644 tests/unit/proxy/pass_through_endpoints/__init__.py create mode 100644 tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/__init__.py rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_batch_attribution.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_cohere_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_comprehend_medical_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_cursor_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_deepgram_listen_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_fal_ai_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_gemini_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_tinyfish_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_transcribe_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_carry_guardrail_logging_info.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_deepgram_ws_passthrough_routes.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_managed_id_rewriter.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_method_specific_routing.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_auth_default.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_endpoint_router.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_endpoints_common_utils.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_guardrail_block_otel_span.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_guardrails.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_guardrails_field_targeting.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_streaming_handler.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_streaming_handler_interrupt.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_upstream_usage_headers.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py (100%) rename tests/{test_litellm => unit}/proxy/pass_through_endpoints/test_watsonx_proxy_route.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_baseline_accounting.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_budget_reservation.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_budget_reservation_redis_failure.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_carried_budget_state.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_cloudzero_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_compression_savings.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_input_tokens.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_key_metadata_recovery.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_ptu_feature_flag.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_ptu_flat_cost_rollup.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_savings.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_capture_rate.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_counter_batch.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_event.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_event_producer.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_log_error_logger.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_management_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_query_optimization.py (100%) rename tests/{test_litellm => unit}/proxy/spend_tracking/test_spend_tracking_utils.py (100%) rename tests/{test_litellm => unit}/proxy/test__types.py (100%) rename tests/{test_litellm => unit}/proxy/test_aiohttp_cleanup_closed.py (100%) rename tests/{test_litellm => unit}/proxy/test_aiohttp_session_recovery.py (100%) rename tests/{test_litellm => unit}/proxy/test_api_key_masking_in_errors.py (100%) rename tests/{test_litellm => unit}/proxy/test_audio_speech_prometheus_hooks.py (99%) rename tests/{test_litellm => unit}/proxy/test_batch_expiry.py (100%) rename tests/{test_litellm => unit}/proxy/test_batch_metadata_none_fix.py (100%) rename tests/{test_litellm => unit}/proxy/test_batch_retrieve_bedrock.py (100%) rename tests/{test_litellm => unit}/proxy/test_batch_x_litellm_model_encoding.py (100%) rename tests/{test_litellm => unit}/proxy/test_blocked_response_usage.py (100%) rename tests/{test_litellm => unit}/proxy/test_body_snapshot_callback_params.py (100%) rename tests/{test_litellm => unit}/proxy/test_budget_reservation.py (100%) rename tests/{test_litellm => unit}/proxy/test_bug_report_config.py (100%) rename tests/{test_litellm => unit}/proxy/test_caching_routes.py (100%) rename tests/{test_litellm => unit}/proxy/test_chat_completion_metadata.py (100%) rename tests/{test_litellm => unit}/proxy/test_claude_code_marketplace.py (100%) rename tests/{test_litellm => unit}/proxy/test_collector.py (100%) rename tests/{test_litellm => unit}/proxy/test_common_request_processing.py (100%) rename tests/{test_litellm => unit}/proxy/test_component_allowlists.py (100%) rename tests/{test_litellm/proxy/test_configs/test_config_no_auth.yaml => unit/proxy/test_configs/test_config_hosted_vllm_embedding.yaml} (100%) rename tests/{test_litellm => unit}/proxy/test_conftest.py (100%) rename tests/{test_litellm => unit}/proxy/test_cors_config.py (100%) rename tests/{test_litellm => unit}/proxy/test_custom_proxy.py (100%) rename tests/{test_litellm => unit}/proxy/test_dynamic_mcp_route.py (100%) rename tests/{test_litellm => unit}/proxy/test_empty_model_list.py (100%) rename tests/{test_litellm => unit}/proxy/test_enforce_user_param.py (99%) rename tests/{test_litellm => unit}/proxy/test_fallback_management_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/test_fastapi_offline_routes.py (100%) rename tests/{test_litellm => unit}/proxy/test_filter_models_by_team_access_group.py (100%) rename tests/{test_litellm => unit}/proxy/test_health_check_functions.py (100%) rename tests/{test_litellm => unit}/proxy/test_health_check_max_tokens.py (100%) rename tests/{test_litellm => unit}/proxy/test_init_litellm_callbacks.py (100%) rename tests/{test_litellm => unit}/proxy/test_langfuse_passthrough_security.py (100%) rename tests/{test_litellm => unit}/proxy/test_lazy_openapi_snapshot.py (100%) rename tests/{test_litellm => unit}/proxy/test_litellm_pre_call_utils.py (100%) rename tests/{test_litellm => unit}/proxy/test_max_budget_env_var.py (100%) rename tests/{test_litellm => unit}/proxy/test_mcp_asgi_response.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_based_routing_files_batches.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_deprecations_endpoint.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_dump_with_preserved_fields.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_id_header_propagation.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_info_default_limits.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_level_guardrails.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_list_aliases.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_list_callback_filter.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_list_discoverable.py (100%) rename tests/{test_litellm => unit}/proxy/test_model_list_healthy_only.py (100%) rename tests/{test_litellm => unit}/proxy/test_modify_response_streaming_passthrough.py (100%) rename tests/{test_litellm => unit}/proxy/test_native_compaction.py (100%) rename tests/{test_litellm => unit}/proxy/test_openai_ws_passthrough_routes.py (100%) rename tests/{test_litellm => unit}/proxy/test_openapi_schema_validation.py (100%) rename tests/{test_litellm => unit}/proxy/test_plugin_routes.py (100%) rename tests/{test_litellm => unit}/proxy/test_pointfive_dashboard_config.py (100%) rename tests/{test_litellm => unit}/proxy/test_pointfive_ui_callback.py (100%) rename tests/{test_litellm => unit}/proxy/test_pricing_field_strip.py (100%) rename tests/{test_litellm => unit}/proxy/test_prisma_engine_watchdog.py (100%) rename tests/{test_litellm => unit}/proxy/test_prisma_migration.py (100%) rename tests/{test_litellm => unit}/proxy/test_prometheus_cleanup.py (100%) rename tests/{test_litellm => unit}/proxy/test_prometheus_metrics_server.py (100%) rename tests/{test_litellm => unit}/proxy/test_provider_url_destination_guard.py (100%) rename tests/{test_litellm => unit}/proxy/test_proxy_cli.py (99%) rename tests/{test_litellm => unit}/proxy/test_proxy_logging_hook_detection.py (100%) rename tests/{test_litellm => unit}/proxy/test_proxy_types.py (100%) rename tests/{test_litellm => unit}/proxy/test_pyroscope.py (100%) rename tests/{test_litellm => unit}/proxy/test_read_model_list.py (100%) rename tests/{test_litellm => unit}/proxy/test_redis_auth_cache_flag.py (98%) rename tests/{test_litellm => unit}/proxy/test_response_model_sanitization.py (100%) rename tests/{test_litellm => unit}/proxy/test_route_a2a_models.py (100%) rename tests/{test_litellm => unit}/proxy/test_route_llm_request.py (100%) rename tests/{test_litellm => unit}/proxy/test_route_priority.py (100%) rename tests/{test_litellm => unit}/proxy/test_sensitive_route_auth.py (100%) rename tests/{test_litellm => unit}/proxy/test_shared_health_check.py (100%) rename tests/{test_litellm => unit}/proxy/test_spend_log_cleanup.py (100%) rename tests/{test_litellm => unit}/proxy/test_swagger_chat_completions.py (100%) rename tests/{test_litellm => unit}/proxy/test_team_member_update.py (100%) rename tests/{test_litellm => unit}/proxy/test_team_org_move.py (100%) rename tests/{test_litellm => unit}/proxy/test_tools_allowlist_enforcement.py (100%) rename tests/{test_litellm => unit}/proxy/test_tracing_endpoints.py (100%) rename tests/{test_litellm => unit}/proxy/test_update_llm_router_resilience.py (100%) rename tests/{test_litellm => unit}/proxy/test_zerobus_dashboard_config.py (100%) create mode 100644 tests/unit/proxy/types_utils/__init__.py rename tests/{test_litellm => unit}/proxy/types_utils/test_db_overlay_remote_module_scrub.py (100%) rename tests/{test_litellm => unit}/proxy/types_utils/test_get_instance_fn_runtime_gate.py (100%) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index a05c26eef7d..c79614c049e 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -199,17 +199,103 @@ jobs: tests/unit/proxy/db --ignore=tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py --ignore=tests/unit/proxy/db/test_update_daily_tag_spend.py - tests/test_litellm/proxy/middleware - tests/test_litellm/proxy/spend_tracking + tests/unit/proxy/middleware + --ignore=tests/unit/proxy/middleware/test_request_size_limit_middleware.py + tests/unit/proxy/spend_tracking + --ignore=tests/unit/proxy/spend_tracking/test_search_api_logging.py + tests/unit/proxy/pass_through_endpoints tests/test_litellm/proxy/pass_through_endpoints tests/unit/proxy/_experimental --ignore=tests/unit/proxy/_experimental/mcp_server - tests/test_litellm/proxy/experimental - tests/test_litellm/proxy/common_utils - tests/test_litellm/proxy/enterprise_billing - tests/test_litellm/proxy/types_utils - tests/test_litellm/proxy/logging_endpoints - tests/test_litellm/proxy/test_*.py + tests/unit/proxy/experimental + tests/unit/proxy/common_utils + --ignore=tests/unit/proxy/common_utils/test_cache_aware_routing.py + --ignore=tests/unit/proxy/common_utils/test_check_batch_cost.py + --ignore=tests/unit/proxy/common_utils/test_check_responses_cost.py + --ignore=tests/unit/proxy/common_utils/test_proxy_encrypt_decrypt.py + --ignore=tests/unit/proxy/common_utils/test_realtime_cache.py + tests/unit/proxy/enterprise_billing + tests/unit/proxy/types_utils + tests/unit/proxy/logging_endpoints + tests/unit/proxy/test__types.py + tests/unit/proxy/test_aiohttp_cleanup_closed.py + tests/unit/proxy/test_aiohttp_session_recovery.py + tests/unit/proxy/test_api_key_masking_in_errors.py + tests/unit/proxy/test_audio_speech_prometheus_hooks.py + tests/unit/proxy/test_batch_expiry.py + tests/unit/proxy/test_batch_metadata_none_fix.py + tests/unit/proxy/test_batch_retrieve_bedrock.py + tests/unit/proxy/test_batch_x_litellm_model_encoding.py + tests/unit/proxy/test_blocked_response_usage.py + tests/unit/proxy/test_body_snapshot_callback_params.py + tests/unit/proxy/test_budget_reservation.py + tests/unit/proxy/test_bug_report_config.py + tests/unit/proxy/test_caching_routes.py + tests/unit/proxy/test_chat_completion_metadata.py + tests/unit/proxy/test_claude_code_marketplace.py + tests/unit/proxy/test_collector.py + tests/unit/proxy/test_common_request_processing.py + tests/unit/proxy/test_component_allowlists.py + tests/unit/proxy/test_conftest.py + tests/unit/proxy/test_cors_config.py + tests/unit/proxy/test_custom_proxy.py + tests/unit/proxy/test_dynamic_mcp_route.py + tests/unit/proxy/test_empty_model_list.py + tests/unit/proxy/test_enforce_user_param.py + tests/unit/proxy/test_fallback_management_endpoints.py + tests/unit/proxy/test_fastapi_offline_routes.py + tests/unit/proxy/test_filter_models_by_team_access_group.py + tests/unit/proxy/test_health_check_functions.py + tests/unit/proxy/test_health_check_max_tokens.py + tests/unit/proxy/test_init_litellm_callbacks.py + tests/unit/proxy/test_langfuse_passthrough_security.py + tests/unit/proxy/test_lazy_openapi_snapshot.py + tests/unit/proxy/test_litellm_pre_call_utils.py + tests/unit/proxy/test_max_budget_env_var.py + tests/unit/proxy/test_mcp_asgi_response.py + tests/unit/proxy/test_model_based_routing_files_batches.py + tests/unit/proxy/test_model_deprecations_endpoint.py + tests/unit/proxy/test_model_dump_with_preserved_fields.py + tests/unit/proxy/test_model_id_header_propagation.py + tests/unit/proxy/test_model_info_default_limits.py + tests/unit/proxy/test_model_level_guardrails.py + tests/unit/proxy/test_model_list_aliases.py + tests/unit/proxy/test_model_list_callback_filter.py + tests/unit/proxy/test_model_list_discoverable.py + tests/unit/proxy/test_model_list_healthy_only.py + tests/unit/proxy/test_modify_response_streaming_passthrough.py + tests/unit/proxy/test_native_compaction.py + tests/unit/proxy/test_openai_ws_passthrough_routes.py + tests/unit/proxy/test_openapi_schema_validation.py + tests/unit/proxy/test_plugin_routes.py + tests/unit/proxy/test_pointfive_dashboard_config.py + tests/unit/proxy/test_pointfive_ui_callback.py + tests/unit/proxy/test_pricing_field_strip.py + tests/unit/proxy/test_prisma_engine_watchdog.py + tests/unit/proxy/test_prisma_migration.py + tests/unit/proxy/test_prometheus_cleanup.py + tests/unit/proxy/test_prometheus_metrics_server.py + tests/unit/proxy/test_provider_url_destination_guard.py + tests/unit/proxy/test_proxy_cli.py + tests/unit/proxy/test_proxy_logging_hook_detection.py + tests/unit/proxy/test_proxy_types.py + tests/unit/proxy/test_pyroscope.py + tests/unit/proxy/test_read_model_list.py + tests/unit/proxy/test_redis_auth_cache_flag.py + tests/unit/proxy/test_response_model_sanitization.py + tests/unit/proxy/test_route_a2a_models.py + tests/unit/proxy/test_route_llm_request.py + tests/unit/proxy/test_route_priority.py + tests/unit/proxy/test_sensitive_route_auth.py + tests/unit/proxy/test_shared_health_check.py + tests/unit/proxy/test_spend_log_cleanup.py + tests/unit/proxy/test_swagger_chat_completions.py + tests/unit/proxy/test_team_member_update.py + tests/unit/proxy/test_team_org_move.py + tests/unit/proxy/test_tools_allowlist_enforcement.py + tests/unit/proxy/test_tracing_endpoints.py + tests/unit/proxy/test_update_llm_router_resilience.py + tests/unit/proxy/test_zerobus_dashboard_config.py tests/unit/proxy/test_proxy_server_endpoints_and_startup.py tests/unit/proxy/test_proxy_utils_model_creation_and_error_logging.py unit-flag: proxy-infra diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a5ad6e97f3d..28538472a3f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,7 +98,7 @@ Add your tests to the [`tests/unit/` directory](https://github.com/BerriAI/litel The `tests/unit/` directory follows the same structure as `litellm/`: -- `litellm/proxy/caching_routes.py` → `tests/test_litellm/proxy/test_caching_routes.py` +- `litellm/proxy/caching_routes.py` → `tests/unit/proxy/test_caching_routes.py` - `litellm/utils.py` → `tests/unit/test_utils.py` ### Example Test diff --git a/Makefile b/Makefile index 421b811d8f3..def7c57a324 100644 --- a/Makefile +++ b/Makefile @@ -326,8 +326,89 @@ test-unit-proxy-guardrails: install-test-deps test-unit-proxy-core: install-test-deps $(UV_RUN) pytest tests/unit/proxy/auth tests/unit/proxy/client tests/unit/proxy/db tests/unit/proxy/hooks tests/unit/proxy/policy_engine --ignore=tests/unit/proxy/db/db_transaction_queue/test_e2e_pod_lock_manager.py --ignore=tests/unit/proxy/db/test_update_daily_tag_spend.py --tb=short -vv -n 4 --durations=20 +PROXY_INFRA_ROOT_TESTS := \ + tests/unit/proxy/test__types.py \ + tests/unit/proxy/test_aiohttp_cleanup_closed.py \ + tests/unit/proxy/test_aiohttp_session_recovery.py \ + tests/unit/proxy/test_api_key_masking_in_errors.py \ + tests/unit/proxy/test_audio_speech_prometheus_hooks.py \ + tests/unit/proxy/test_batch_expiry.py \ + tests/unit/proxy/test_batch_metadata_none_fix.py \ + tests/unit/proxy/test_batch_retrieve_bedrock.py \ + tests/unit/proxy/test_batch_x_litellm_model_encoding.py \ + tests/unit/proxy/test_blocked_response_usage.py \ + tests/unit/proxy/test_body_snapshot_callback_params.py \ + tests/unit/proxy/test_budget_reservation.py \ + tests/unit/proxy/test_bug_report_config.py \ + tests/unit/proxy/test_caching_routes.py \ + tests/unit/proxy/test_chat_completion_metadata.py \ + tests/unit/proxy/test_claude_code_marketplace.py \ + tests/unit/proxy/test_collector.py \ + tests/unit/proxy/test_common_request_processing.py \ + tests/unit/proxy/test_component_allowlists.py \ + tests/unit/proxy/test_conftest.py \ + tests/unit/proxy/test_cors_config.py \ + tests/unit/proxy/test_custom_proxy.py \ + tests/unit/proxy/test_dynamic_mcp_route.py \ + tests/unit/proxy/test_empty_model_list.py \ + tests/unit/proxy/test_enforce_user_param.py \ + tests/unit/proxy/test_fallback_management_endpoints.py \ + tests/unit/proxy/test_fastapi_offline_routes.py \ + tests/unit/proxy/test_filter_models_by_team_access_group.py \ + tests/unit/proxy/test_health_check_functions.py \ + tests/unit/proxy/test_health_check_max_tokens.py \ + tests/unit/proxy/test_init_litellm_callbacks.py \ + tests/unit/proxy/test_langfuse_passthrough_security.py \ + tests/unit/proxy/test_lazy_openapi_snapshot.py \ + tests/unit/proxy/test_litellm_pre_call_utils.py \ + tests/unit/proxy/test_max_budget_env_var.py \ + tests/unit/proxy/test_mcp_asgi_response.py \ + tests/unit/proxy/test_model_based_routing_files_batches.py \ + tests/unit/proxy/test_model_deprecations_endpoint.py \ + tests/unit/proxy/test_model_dump_with_preserved_fields.py \ + tests/unit/proxy/test_model_id_header_propagation.py \ + tests/unit/proxy/test_model_info_default_limits.py \ + tests/unit/proxy/test_model_level_guardrails.py \ + tests/unit/proxy/test_model_list_aliases.py \ + tests/unit/proxy/test_model_list_callback_filter.py \ + tests/unit/proxy/test_model_list_discoverable.py \ + tests/unit/proxy/test_model_list_healthy_only.py \ + tests/unit/proxy/test_modify_response_streaming_passthrough.py \ + tests/unit/proxy/test_native_compaction.py \ + tests/unit/proxy/test_openai_ws_passthrough_routes.py \ + tests/unit/proxy/test_openapi_schema_validation.py \ + tests/unit/proxy/test_plugin_routes.py \ + tests/unit/proxy/test_pointfive_dashboard_config.py \ + tests/unit/proxy/test_pointfive_ui_callback.py \ + tests/unit/proxy/test_pricing_field_strip.py \ + tests/unit/proxy/test_prisma_engine_watchdog.py \ + tests/unit/proxy/test_prisma_migration.py \ + tests/unit/proxy/test_prometheus_cleanup.py \ + tests/unit/proxy/test_prometheus_metrics_server.py \ + tests/unit/proxy/test_provider_url_destination_guard.py \ + tests/unit/proxy/test_proxy_cli.py \ + tests/unit/proxy/test_proxy_logging_hook_detection.py \ + tests/unit/proxy/test_proxy_types.py \ + tests/unit/proxy/test_pyroscope.py \ + tests/unit/proxy/test_read_model_list.py \ + tests/unit/proxy/test_redis_auth_cache_flag.py \ + tests/unit/proxy/test_response_model_sanitization.py \ + tests/unit/proxy/test_route_a2a_models.py \ + tests/unit/proxy/test_route_llm_request.py \ + tests/unit/proxy/test_route_priority.py \ + tests/unit/proxy/test_sensitive_route_auth.py \ + tests/unit/proxy/test_shared_health_check.py \ + tests/unit/proxy/test_spend_log_cleanup.py \ + tests/unit/proxy/test_swagger_chat_completions.py \ + tests/unit/proxy/test_team_member_update.py \ + tests/unit/proxy/test_team_org_move.py \ + tests/unit/proxy/test_tools_allowlist_enforcement.py \ + tests/unit/proxy/test_tracing_endpoints.py \ + tests/unit/proxy/test_update_llm_router_resilience.py \ + tests/unit/proxy/test_zerobus_dashboard_config.py + test-unit-proxy-misc: install-test-deps - $(UV_RUN) pytest tests/unit/proxy/agent_endpoints tests/unit/proxy/anthropic_endpoints tests/test_litellm/proxy/common_utils tests/unit/proxy/discovery_endpoints tests/test_litellm/proxy/experimental tests/unit/proxy/google_endpoints tests/unit/proxy/health_endpoints tests/unit/proxy/image_endpoints tests/test_litellm/proxy/middleware tests/unit/proxy/openai_files_endpoint tests/test_litellm/proxy/pass_through_endpoints tests/unit/proxy/prompts tests/unit/proxy/public_endpoints tests/unit/proxy/response_api_endpoints tests/unit/proxy/shutdown tests/test_litellm/proxy/spend_tracking tests/unit/proxy/ui_crud_endpoints tests/unit/proxy/vector_store_endpoints tests/test_litellm/proxy/test_*.py tests/unit/proxy/test_proxy_server_endpoints_and_startup.py tests/unit/proxy/test_proxy_utils_model_creation_and_error_logging.py tests/unit/proxy/_experimental/mcp_server/test_mcp_server_tool_calls_and_headers.py --ignore=tests/unit/proxy/google_endpoints/test_gemini_agents_endpoints.py --ignore=tests/unit/proxy/google_endpoints/test_google_endpoint_routing.py --ignore=tests/unit/proxy/google_endpoints/test_google_gemini_proxy_request.py --ignore=tests/unit/proxy/public_endpoints/test_blog_posts_endpoint.py --tb=short -vv -n 4 --durations=20 + $(UV_RUN) pytest tests/unit/proxy/agent_endpoints tests/unit/proxy/anthropic_endpoints tests/unit/proxy/common_utils --ignore=tests/unit/proxy/common_utils/test_cache_aware_routing.py --ignore=tests/unit/proxy/common_utils/test_check_batch_cost.py --ignore=tests/unit/proxy/common_utils/test_check_responses_cost.py --ignore=tests/unit/proxy/common_utils/test_proxy_encrypt_decrypt.py --ignore=tests/unit/proxy/common_utils/test_realtime_cache.py tests/unit/proxy/discovery_endpoints tests/unit/proxy/experimental tests/unit/proxy/google_endpoints tests/unit/proxy/health_endpoints tests/unit/proxy/image_endpoints tests/unit/proxy/middleware --ignore=tests/unit/proxy/middleware/test_request_size_limit_middleware.py tests/unit/proxy/openai_files_endpoint tests/unit/proxy/pass_through_endpoints tests/test_litellm/proxy/pass_through_endpoints tests/unit/proxy/prompts tests/unit/proxy/public_endpoints tests/unit/proxy/response_api_endpoints tests/unit/proxy/shutdown tests/unit/proxy/spend_tracking --ignore=tests/unit/proxy/spend_tracking/test_search_api_logging.py tests/unit/proxy/ui_crud_endpoints tests/unit/proxy/vector_store_endpoints $(PROXY_INFRA_ROOT_TESTS) tests/unit/proxy/test_proxy_server_endpoints_and_startup.py tests/unit/proxy/test_proxy_utils_model_creation_and_error_logging.py tests/unit/proxy/_experimental/mcp_server/test_mcp_server_tool_calls_and_headers.py --ignore=tests/unit/proxy/google_endpoints/test_gemini_agents_endpoints.py --ignore=tests/unit/proxy/google_endpoints/test_google_endpoint_routing.py --ignore=tests/unit/proxy/google_endpoints/test_google_gemini_proxy_request.py --ignore=tests/unit/proxy/public_endpoints/test_blog_posts_endpoint.py --tb=short -vv -n 4 --durations=20 test-unit-integrations: install-test-deps $(UV_RUN) pytest tests/unit/integrations --tb=short -vv -n 4 --durations=20 diff --git a/scripts/test_tool_allowlist_script.py b/scripts/test_tool_allowlist_script.py index f94aac60f80..607a8c39473 100644 --- a/scripts/test_tool_allowlist_script.py +++ b/scripts/test_tool_allowlist_script.py @@ -6,7 +6,7 @@ Run from repo root: uv run python scripts/test_tool_allowlist_script.py Or run the unit tests: - uv run pytest tests/test_litellm/proxy/test_tools_allowlist_enforcement.py -v + uv run pytest tests/unit/proxy/test_tools_allowlist_enforcement.py -v """ import asyncio @@ -148,7 +148,7 @@ def main(): asyncio.run(test_check_tools_allowlist()) print("Done. For full unit tests run:") print( - " uv run pytest tests/test_litellm/proxy/test_tools_allowlist_enforcement.py -v" + " uv run pytest tests/unit/proxy/test_tools_allowlist_enforcement.py -v" ) diff --git a/tests/e2e/quota_management/spend_tracking/SPEND_TRACKING_COVERAGE_MATRIX.md b/tests/e2e/quota_management/spend_tracking/SPEND_TRACKING_COVERAGE_MATRIX.md index 32dc0c47dda..d9380098891 100644 --- a/tests/e2e/quota_management/spend_tracking/SPEND_TRACKING_COVERAGE_MATRIX.md +++ b/tests/e2e/quota_management/spend_tracking/SPEND_TRACKING_COVERAGE_MATRIX.md @@ -6,7 +6,7 @@ that would catch a regression. Companion: live suite `test_spend_tracking_e2e.py` + route breadth `test_spend_routes.py` (this directory). Offline regression suite: -`tests/test_litellm/proxy/spend_tracking/`. Reference PR: BerriAI/litellm#29956. +`tests/unit/proxy/spend_tracking/`. Reference PR: BerriAI/litellm#29956. Levels: `unit` mocked; `integration` real DB/cost-map; `live` real provider + proxy + SpendLogs rows. Status: `covered` / `partial` / `gap`. diff --git a/tests/test_spend_logs.py b/tests/test_spend_logs.py index c575fa07551..f0dda539352 100644 --- a/tests/test_spend_logs.py +++ b/tests/test_spend_logs.py @@ -101,7 +101,7 @@ async def get_spend_logs(session, request_id=None, api_key=None): @pytest.mark.skip( - reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Spend-log accuracy is covered by tests/test_litellm/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job." + reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Spend-log accuracy is covered by tests/unit/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job." ) @pytest.mark.asyncio async def test_spend_logs(): @@ -159,7 +159,7 @@ async def generate_team(session: aiohttp.ClientSession, org_id: str) -> dict: @pytest.mark.skip( - reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Same write-then-read race against the spend logs DB as test_spend_logs. Spend-log accuracy is covered by tests/test_litellm/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job." + reason="Flaky in CI: /spend/logs?request_id=... returns 500 even after a 20s wait for the spend log to be written. Same write-then-read race against the spend logs DB as test_spend_logs. Spend-log accuracy is covered by tests/unit/proxy/spend_tracking/ and the proxy_spend_accuracy_tests CircleCI job." ) @pytest.mark.asyncio async def test_spend_logs_with_org_id(): diff --git a/tests/test_litellm/proxy/logging_endpoints/__init__.py b/tests/unit/proxy/common_utils/html_forms/__init__.py similarity index 100% rename from tests/test_litellm/proxy/logging_endpoints/__init__.py rename to tests/unit/proxy/common_utils/html_forms/__init__.py diff --git a/tests/test_litellm/proxy/common_utils/html_forms/test_native_client_consent.py b/tests/unit/proxy/common_utils/html_forms/test_native_client_consent.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/html_forms/test_native_client_consent.py rename to tests/unit/proxy/common_utils/html_forms/test_native_client_consent.py diff --git a/tests/test_litellm/proxy/common_utils/html_forms/test_ui_login.py b/tests/unit/proxy/common_utils/html_forms/test_ui_login.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/html_forms/test_ui_login.py rename to tests/unit/proxy/common_utils/html_forms/test_ui_login.py diff --git a/tests/test_litellm/proxy/common_utils/test_admin_ui_utils.py b/tests/unit/proxy/common_utils/test_admin_ui_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_admin_ui_utils.py rename to tests/unit/proxy/common_utils/test_admin_ui_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_auth_cache_invalidation_pubsub.py b/tests/unit/proxy/common_utils/test_auth_cache_invalidation_pubsub.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_auth_cache_invalidation_pubsub.py rename to tests/unit/proxy/common_utils/test_auth_cache_invalidation_pubsub.py diff --git a/tests/test_litellm/proxy/common_utils/test_cache_codec.py b/tests/unit/proxy/common_utils/test_cache_codec.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_cache_codec.py rename to tests/unit/proxy/common_utils/test_cache_codec.py diff --git a/tests/test_litellm/proxy/common_utils/test_callback_config_validation.py b/tests/unit/proxy/common_utils/test_callback_config_validation.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_callback_config_validation.py rename to tests/unit/proxy/common_utils/test_callback_config_validation.py diff --git a/tests/test_litellm/proxy/common_utils/test_callback_utils.py b/tests/unit/proxy/common_utils/test_callback_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_callback_utils.py rename to tests/unit/proxy/common_utils/test_callback_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_config_sync_pubsub.py b/tests/unit/proxy/common_utils/test_config_sync_pubsub.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_config_sync_pubsub.py rename to tests/unit/proxy/common_utils/test_config_sync_pubsub.py diff --git a/tests/test_litellm/proxy/common_utils/test_custom_openapi_spec.py b/tests/unit/proxy/common_utils/test_custom_openapi_spec.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_custom_openapi_spec.py rename to tests/unit/proxy/common_utils/test_custom_openapi_spec.py diff --git a/tests/test_litellm/proxy/common_utils/test_debug_utils.py b/tests/unit/proxy/common_utils/test_debug_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_debug_utils.py rename to tests/unit/proxy/common_utils/test_debug_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_discoverable_model_filter.py b/tests/unit/proxy/common_utils/test_discoverable_model_filter.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_discoverable_model_filter.py rename to tests/unit/proxy/common_utils/test_discoverable_model_filter.py diff --git a/tests/test_litellm/proxy/common_utils/test_encrypt_decrypt_utils.py b/tests/unit/proxy/common_utils/test_encrypt_decrypt_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_encrypt_decrypt_utils.py rename to tests/unit/proxy/common_utils/test_encrypt_decrypt_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_error_body_call_id.py b/tests/unit/proxy/common_utils/test_error_body_call_id.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_error_body_call_id.py rename to tests/unit/proxy/common_utils/test_error_body_call_id.py diff --git a/tests/test_litellm/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py b/tests/unit/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py rename to tests/unit/proxy/common_utils/test_expired_ui_session_key_cleanup_manager.py diff --git a/tests/test_litellm/proxy/common_utils/test_get_routes.py b/tests/unit/proxy/common_utils/test_get_routes.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_get_routes.py rename to tests/unit/proxy/common_utils/test_get_routes.py diff --git a/tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py b/tests/unit/proxy/common_utils/test_http_parsing_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_http_parsing_utils.py rename to tests/unit/proxy/common_utils/test_http_parsing_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_json_merge_patch.py b/tests/unit/proxy/common_utils/test_json_merge_patch.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_json_merge_patch.py rename to tests/unit/proxy/common_utils/test_json_merge_patch.py diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_e2e.py b/tests/unit/proxy/common_utils/test_key_rotation_e2e.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_key_rotation_e2e.py rename to tests/unit/proxy/common_utils/test_key_rotation_e2e.py diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_integration.py b/tests/unit/proxy/common_utils/test_key_rotation_integration.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_key_rotation_integration.py rename to tests/unit/proxy/common_utils/test_key_rotation_integration.py diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_lock.py b/tests/unit/proxy/common_utils/test_key_rotation_lock.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_key_rotation_lock.py rename to tests/unit/proxy/common_utils/test_key_rotation_lock.py diff --git a/tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py b/tests/unit/proxy/common_utils/test_key_rotation_manager.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_key_rotation_manager.py rename to tests/unit/proxy/common_utils/test_key_rotation_manager.py diff --git a/tests/test_litellm/proxy/common_utils/test_load_config_utils.py b/tests/unit/proxy/common_utils/test_load_config_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_load_config_utils.py rename to tests/unit/proxy/common_utils/test_load_config_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_model_deprecation.py b/tests/unit/proxy/common_utils/test_model_deprecation.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_model_deprecation.py rename to tests/unit/proxy/common_utils/test_model_deprecation.py diff --git a/tests/test_litellm/proxy/common_utils/test_model_listing_utils.py b/tests/unit/proxy/common_utils/test_model_listing_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_model_listing_utils.py rename to tests/unit/proxy/common_utils/test_model_listing_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_openai_endpoint_utils.py b/tests/unit/proxy/common_utils/test_openai_endpoint_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_openai_endpoint_utils.py rename to tests/unit/proxy/common_utils/test_openai_endpoint_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_openai_error_payload.py b/tests/unit/proxy/common_utils/test_openai_error_payload.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_openai_error_payload.py rename to tests/unit/proxy/common_utils/test_openai_error_payload.py diff --git a/tests/test_litellm/proxy/common_utils/test_path_utils.py b/tests/unit/proxy/common_utils/test_path_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_path_utils.py rename to tests/unit/proxy/common_utils/test_path_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_periodic_reload_schedule.py b/tests/unit/proxy/common_utils/test_periodic_reload_schedule.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_periodic_reload_schedule.py rename to tests/unit/proxy/common_utils/test_periodic_reload_schedule.py diff --git a/tests/test_litellm/proxy/common_utils/test_prompt_cache_pricing.py b/tests/unit/proxy/common_utils/test_prompt_cache_pricing.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_prompt_cache_pricing.py rename to tests/unit/proxy/common_utils/test_prompt_cache_pricing.py diff --git a/tests/test_litellm/proxy/common_utils/test_rbac_utils.py b/tests/unit/proxy/common_utils/test_rbac_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_rbac_utils.py rename to tests/unit/proxy/common_utils/test_rbac_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_registry_read_through.py b/tests/unit/proxy/common_utils/test_registry_read_through.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_registry_read_through.py rename to tests/unit/proxy/common_utils/test_registry_read_through.py diff --git a/tests/test_litellm/proxy/common_utils/test_reset_budget_job.py b/tests/unit/proxy/common_utils/test_reset_budget_job.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_reset_budget_job.py rename to tests/unit/proxy/common_utils/test_reset_budget_job.py diff --git a/tests/test_litellm/proxy/common_utils/test_scheduled_job_stagger.py b/tests/unit/proxy/common_utils/test_scheduled_job_stagger.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_scheduled_job_stagger.py rename to tests/unit/proxy/common_utils/test_scheduled_job_stagger.py diff --git a/tests/test_litellm/proxy/common_utils/test_sse_keepalive.py b/tests/unit/proxy/common_utils/test_sse_keepalive.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_sse_keepalive.py rename to tests/unit/proxy/common_utils/test_sse_keepalive.py diff --git a/tests/test_litellm/proxy/common_utils/test_static_asset_utils.py b/tests/unit/proxy/common_utils/test_static_asset_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_static_asset_utils.py rename to tests/unit/proxy/common_utils/test_static_asset_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_swagger_utils.py b/tests/unit/proxy/common_utils/test_swagger_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_swagger_utils.py rename to tests/unit/proxy/common_utils/test_swagger_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_timezone_utils.py b/tests/unit/proxy/common_utils/test_timezone_utils.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_timezone_utils.py rename to tests/unit/proxy/common_utils/test_timezone_utils.py diff --git a/tests/test_litellm/proxy/common_utils/test_upsert_budget_membership.py b/tests/unit/proxy/common_utils/test_upsert_budget_membership.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_upsert_budget_membership.py rename to tests/unit/proxy/common_utils/test_upsert_budget_membership.py diff --git a/tests/test_litellm/proxy/common_utils/test_user_api_key_cache.py b/tests/unit/proxy/common_utils/test_user_api_key_cache.py similarity index 100% rename from tests/test_litellm/proxy/common_utils/test_user_api_key_cache.py rename to tests/unit/proxy/common_utils/test_user_api_key_cache.py diff --git a/tests/unit/proxy/conftest.py b/tests/unit/proxy/conftest.py index 23b4b6078f7..50c89387d80 100644 --- a/tests/unit/proxy/conftest.py +++ b/tests/unit/proxy/conftest.py @@ -3,11 +3,15 @@ import asyncio import copy import inspect +import os +import tempfile import warnings from collections.abc import Iterator -from typing import Dict +from typing import Dict, Optional import pytest +import yaml +from fastapi.testclient import TestClient from prisma.errors import ClientNotConnectedError @@ -245,3 +249,168 @@ def _reset_graceful_shutdown_state(): GracefulShutdownManager.reset() yield GracefulShutdownManager.reset() + + +def build_cache_config(enable_cache: bool = True) -> Optional[Dict]: + """ + Build Redis cache configuration from environment variables. + + Args: + enable_cache: Whether to enable cache (default: True) + + Returns: + dict: Cache configuration dict with 'cache' and 'cache_params' keys, or None + """ + if not enable_cache: + return None + + redis_host = os.getenv("REDIS_HOST") + if not redis_host: + return None + + redis_port = os.getenv("REDIS_PORT", "6379") + cache_params = { + "type": "redis", + "host": redis_host, + "port": int(redis_port) if redis_port.isdigit() else redis_port, + } + + redis_password = os.getenv("REDIS_PASSWORD") + if redis_password: + cache_params["password"] = redis_password + + return {"cache": True, "cache_params": cache_params} + + +def build_minimal_proxy_config( + database_url: Optional[str] = None, **init_options +) -> Dict: + """ + Build a minimal proxy configuration YAML. + + Args: + database_url: Optional database URL (falls back to DATABASE_URL env var) + **init_options: Additional configuration options: + - master_key: API key for authentication (default: "sk-1234") + - enable_cache: Whether to enable Redis cache (default: True) + - success_callback: Callback function for success events + + Returns: + dict: Configuration dictionary ready to be written as YAML + """ + config = { + "general_settings": {"master_key": init_options.get("master_key", "sk-1234")}, + "litellm_settings": {}, + } + + db_url = database_url or os.getenv("DATABASE_URL") + if db_url: + config["general_settings"]["database_url"] = db_url + + enable_cache = init_options.get("enable_cache", True) + cache_config = build_cache_config(enable_cache=enable_cache) + if cache_config: + config["litellm_settings"].update(cache_config) + + if init_options.get("success_callback") is not None: + config["litellm_settings"]["success_callback"] = init_options[ + "success_callback" + ] + + excluded_keys = { + "master_key", + "debug", + "success_callback", + "database_url", + "enable_cache", + } + for key, value in init_options.items(): + if key not in excluded_keys and key not in config["litellm_settings"]: + config["litellm_settings"][key] = value + + return config + + +def set_proxy_environment_variables( + monkeypatch, database_url: Optional[str] = None +) -> None: + """ + Set environment variables for database and Redis. + + Args: + monkeypatch: pytest monkeypatch fixture + database_url: Optional database URL (falls back to DATABASE_URL env var) + """ + db_url = database_url or os.getenv("DATABASE_URL") + if db_url: + monkeypatch.setenv("DATABASE_URL", db_url) + + redis_host = os.getenv("REDIS_HOST") + if redis_host: + monkeypatch.setenv("REDIS_HOST", redis_host) + monkeypatch.setenv("REDIS_PORT", os.getenv("REDIS_PORT", "6379")) + redis_password = os.getenv("REDIS_PASSWORD") + if redis_password: + monkeypatch.setenv("REDIS_PASSWORD", redis_password) + + +def create_proxy_test_client( + monkeypatch, database_url: Optional[str] = None, **init_options +) -> TestClient: + """ + Create a proxy TestClient with optional database and Redis cache configuration. + + Args: + monkeypatch: pytest monkeypatch fixture + database_url: Optional database URL (falls back to DATABASE_URL env var) + **init_options: Additional configuration options: + - master_key: API key for authentication (default: "sk-1234") + - enable_cache: Whether to enable Redis cache (default: True) + - success_callback: Callback function for success events + - debug: Enable debug mode + + Returns: + TestClient: FastAPI test client for the proxy server + """ + from litellm.proxy.proxy_server import ( + cleanup_router_config_variables, + initialize, + app, + ) + + cleanup_router_config_variables() + + filepath = os.path.dirname(os.path.abspath(__file__)) + default_config_fp = os.path.join( + filepath, "test_configs", "test_config_hosted_vllm_embedding.yaml" + ) + + enable_cache = init_options.get("enable_cache", True) + needs_redis = enable_cache and os.getenv("REDIS_HOST") is not None + needs_db = (database_url or os.getenv("DATABASE_URL")) is not None + + if not os.path.exists(default_config_fp) or needs_redis or needs_db: + minimal_config = build_minimal_proxy_config( + database_url=database_url, **init_options + ) + + with tempfile.NamedTemporaryFile(mode="w", suffix=".yaml", delete=False) as f: + yaml.dump(minimal_config, f) + config_fp = f.name + else: + config_fp = default_config_fp + + set_proxy_environment_variables(monkeypatch, database_url=database_url) + monkeypatch.setenv("LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY", "true") + + asyncio.run(initialize(config=config_fp, debug=init_options.get("debug", False))) + return TestClient(app) + + +@pytest.fixture +def fresh_agent_read_through(monkeypatch): + from litellm.proxy.common_utils import registry_read_through + + read_through = registry_read_through.RegistryReadThrough(resync=registry_read_through._resync_agents) + monkeypatch.setattr(registry_read_through, "agent_registry_read_through", read_through) + return read_through diff --git a/tests/test_litellm/proxy/types_utils/__init__.py b/tests/unit/proxy/enterprise_billing/__init__.py similarity index 100% rename from tests/test_litellm/proxy/types_utils/__init__.py rename to tests/unit/proxy/enterprise_billing/__init__.py diff --git a/tests/test_litellm/proxy/enterprise_billing/test_billing_metrics.py b/tests/unit/proxy/enterprise_billing/test_billing_metrics.py similarity index 100% rename from tests/test_litellm/proxy/enterprise_billing/test_billing_metrics.py rename to tests/unit/proxy/enterprise_billing/test_billing_metrics.py diff --git a/tests/unit/proxy/experimental/__init__.py b/tests/unit/proxy/experimental/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/unit/proxy/experimental/mcp_server/__init__.py b/tests/unit/proxy/experimental/mcp_server/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/test_litellm/proxy/experimental/mcp_server/test_tool_registry.py b/tests/unit/proxy/experimental/mcp_server/test_tool_registry.py similarity index 95% rename from tests/test_litellm/proxy/experimental/mcp_server/test_tool_registry.py rename to tests/unit/proxy/experimental/mcp_server/test_tool_registry.py index 9fc2e8744c1..c7df359aae2 100644 --- a/tests/test_litellm/proxy/experimental/mcp_server/test_tool_registry.py +++ b/tests/unit/proxy/experimental/mcp_server/test_tool_registry.py @@ -59,7 +59,7 @@ def test_load_tools_from_config(): "name": "config_tool", "description": "A tool from config", "input_schema": {"type": "object"}, - "handler": "test_tool_registry.example_handler", + "handler": "tests.unit.proxy.experimental.mcp_server.test_tool_registry.example_handler", } ] diff --git a/tests/unit/proxy/health_endpoints/test_health_endpoints.py b/tests/unit/proxy/health_endpoints/test_health_endpoints.py index 3ec5176159d..f40c33b1e91 100644 --- a/tests/unit/proxy/health_endpoints/test_health_endpoints.py +++ b/tests/unit/proxy/health_endpoints/test_health_endpoints.py @@ -35,7 +35,7 @@ from litellm.proxy.health_endpoints._health_endpoints import ( ) # Import shared proxy test helpers from conftest -from tests.test_litellm.proxy.conftest import create_proxy_test_client +from tests.unit.proxy.conftest import create_proxy_test_client @pytest.mark.asyncio diff --git a/tests/unit/proxy/logging_endpoints/__init__.py b/tests/unit/proxy/logging_endpoints/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/test_litellm/proxy/logging_endpoints/test_callback_logs_endpoints.py b/tests/unit/proxy/logging_endpoints/test_callback_logs_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/logging_endpoints/test_callback_logs_endpoints.py rename to tests/unit/proxy/logging_endpoints/test_callback_logs_endpoints.py diff --git a/tests/test_litellm/proxy/middleware/test_admission_control_middleware.py b/tests/unit/proxy/middleware/test_admission_control_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_admission_control_middleware.py rename to tests/unit/proxy/middleware/test_admission_control_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_billable_request_metrics_middleware.py b/tests/unit/proxy/middleware/test_billable_request_metrics_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_billable_request_metrics_middleware.py rename to tests/unit/proxy/middleware/test_billable_request_metrics_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_budget_reservation_release_middleware.py b/tests/unit/proxy/middleware/test_budget_reservation_release_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_budget_reservation_release_middleware.py rename to tests/unit/proxy/middleware/test_budget_reservation_release_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py b/tests/unit/proxy/middleware/test_in_flight_requests_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_in_flight_requests_middleware.py rename to tests/unit/proxy/middleware/test_in_flight_requests_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_per_request_root_path_middleware.py b/tests/unit/proxy/middleware/test_per_request_root_path_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_per_request_root_path_middleware.py rename to tests/unit/proxy/middleware/test_per_request_root_path_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_prometheus_auth_middleware.py b/tests/unit/proxy/middleware/test_prometheus_auth_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_prometheus_auth_middleware.py rename to tests/unit/proxy/middleware/test_prometheus_auth_middleware.py diff --git a/tests/test_litellm/proxy/middleware/test_prometheus_auth_middleware_asgi.py b/tests/unit/proxy/middleware/test_prometheus_auth_middleware_asgi.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_prometheus_auth_middleware_asgi.py rename to tests/unit/proxy/middleware/test_prometheus_auth_middleware_asgi.py diff --git a/tests/test_litellm/proxy/middleware/test_security_headers_middleware.py b/tests/unit/proxy/middleware/test_security_headers_middleware.py similarity index 100% rename from tests/test_litellm/proxy/middleware/test_security_headers_middleware.py rename to tests/unit/proxy/middleware/test_security_headers_middleware.py diff --git a/tests/unit/proxy/pass_through_endpoints/__init__.py b/tests/unit/proxy/pass_through_endpoints/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/__init__.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_anthropic_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_azure_speech_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_batch_attribution.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_batch_attribution.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_batch_attribution.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_batch_attribution.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_cohere_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_cohere_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_cohere_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_cohere_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_comprehend_medical_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_comprehend_medical_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_comprehend_medical_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_comprehend_medical_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_cursor_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_cursor_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_cursor_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_cursor_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_deepgram_listen_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_deepgram_listen_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_deepgram_listen_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_deepgram_listen_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_fal_ai_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_fal_ai_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_fal_ai_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_fal_ai_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_gemini_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_gemini_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_gemini_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_gemini_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_openai_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_tinyfish_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_tinyfish_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_tinyfish_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_tinyfish_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_transcribe_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_transcribe_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_transcribe_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_transcribe_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py b/tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py rename to tests/unit/proxy/pass_through_endpoints/llm_provider_handlers/test_typesafe_passthrough_logging_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_carry_guardrail_logging_info.py b/tests/unit/proxy/pass_through_endpoints/test_carry_guardrail_logging_info.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_carry_guardrail_logging_info.py rename to tests/unit/proxy/pass_through_endpoints/test_carry_guardrail_logging_info.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_deepgram_ws_passthrough_routes.py b/tests/unit/proxy/pass_through_endpoints/test_deepgram_ws_passthrough_routes.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_deepgram_ws_passthrough_routes.py rename to tests/unit/proxy/pass_through_endpoints/test_deepgram_ws_passthrough_routes.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py b/tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py rename to tests/unit/proxy/pass_through_endpoints/test_llm_pass_through_endpoints.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_managed_id_rewriter.py b/tests/unit/proxy/pass_through_endpoints/test_managed_id_rewriter.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_managed_id_rewriter.py rename to tests/unit/proxy/pass_through_endpoints/test_managed_id_rewriter.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_method_specific_routing.py b/tests/unit/proxy/pass_through_endpoints/test_method_specific_routing.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_method_specific_routing.py rename to tests/unit/proxy/pass_through_endpoints/test_method_specific_routing.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_auth_default.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_auth_default.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_auth_default.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_auth_default.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_endpoint_router.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_endpoint_router.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_endpoint_router.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_endpoint_router.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_endpoints_common_utils.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_endpoints_common_utils.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_endpoints_common_utils.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_endpoints_common_utils.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrail_block_otel_span.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrail_block_otel_span.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrail_block_otel_span.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrail_block_otel_span.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrails.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrails.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrails.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrails.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrails_field_targeting.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrails_field_targeting.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_guardrails_field_targeting.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_guardrails_field_targeting.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py b/tests/unit/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py rename to tests/unit/proxy/pass_through_endpoints/test_passthrough_post_call_guardrails.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_streaming_handler.py b/tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_streaming_handler.py rename to tests/unit/proxy/pass_through_endpoints/test_streaming_handler.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_streaming_handler_interrupt.py b/tests/unit/proxy/pass_through_endpoints/test_streaming_handler_interrupt.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_streaming_handler_interrupt.py rename to tests/unit/proxy/pass_through_endpoints/test_streaming_handler_interrupt.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_upstream_usage_headers.py b/tests/unit/proxy/pass_through_endpoints/test_upstream_usage_headers.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_upstream_usage_headers.py rename to tests/unit/proxy/pass_through_endpoints/test_upstream_usage_headers.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py b/tests/unit/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py rename to tests/unit/proxy/pass_through_endpoints/test_vertex_ai_batch_passthrough.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py b/tests/unit/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py rename to tests/unit/proxy/pass_through_endpoints/test_vertex_passthrough_load_balancing.py diff --git a/tests/test_litellm/proxy/pass_through_endpoints/test_watsonx_proxy_route.py b/tests/unit/proxy/pass_through_endpoints/test_watsonx_proxy_route.py similarity index 100% rename from tests/test_litellm/proxy/pass_through_endpoints/test_watsonx_proxy_route.py rename to tests/unit/proxy/pass_through_endpoints/test_watsonx_proxy_route.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_baseline_accounting.py b/tests/unit/proxy/spend_tracking/test_baseline_accounting.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_baseline_accounting.py rename to tests/unit/proxy/spend_tracking/test_baseline_accounting.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_budget_reservation.py b/tests/unit/proxy/spend_tracking/test_budget_reservation.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_budget_reservation.py rename to tests/unit/proxy/spend_tracking/test_budget_reservation.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_budget_reservation_redis_failure.py b/tests/unit/proxy/spend_tracking/test_budget_reservation_redis_failure.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_budget_reservation_redis_failure.py rename to tests/unit/proxy/spend_tracking/test_budget_reservation_redis_failure.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_carried_budget_state.py b/tests/unit/proxy/spend_tracking/test_carried_budget_state.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_carried_budget_state.py rename to tests/unit/proxy/spend_tracking/test_carried_budget_state.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_cloudzero_endpoints.py b/tests/unit/proxy/spend_tracking/test_cloudzero_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_cloudzero_endpoints.py rename to tests/unit/proxy/spend_tracking/test_cloudzero_endpoints.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_compression_savings.py b/tests/unit/proxy/spend_tracking/test_compression_savings.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_compression_savings.py rename to tests/unit/proxy/spend_tracking/test_compression_savings.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_input_tokens.py b/tests/unit/proxy/spend_tracking/test_input_tokens.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_input_tokens.py rename to tests/unit/proxy/spend_tracking/test_input_tokens.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_key_metadata_recovery.py b/tests/unit/proxy/spend_tracking/test_key_metadata_recovery.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_key_metadata_recovery.py rename to tests/unit/proxy/spend_tracking/test_key_metadata_recovery.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_ptu_feature_flag.py b/tests/unit/proxy/spend_tracking/test_ptu_feature_flag.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_ptu_feature_flag.py rename to tests/unit/proxy/spend_tracking/test_ptu_feature_flag.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_ptu_flat_cost_rollup.py b/tests/unit/proxy/spend_tracking/test_ptu_flat_cost_rollup.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_ptu_flat_cost_rollup.py rename to tests/unit/proxy/spend_tracking/test_ptu_flat_cost_rollup.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_savings.py b/tests/unit/proxy/spend_tracking/test_savings.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_savings.py rename to tests/unit/proxy/spend_tracking/test_savings.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_capture_rate.py b/tests/unit/proxy/spend_tracking/test_spend_capture_rate.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_capture_rate.py rename to tests/unit/proxy/spend_tracking/test_spend_capture_rate.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_counter_batch.py b/tests/unit/proxy/spend_tracking/test_spend_counter_batch.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_counter_batch.py rename to tests/unit/proxy/spend_tracking/test_spend_counter_batch.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_event.py b/tests/unit/proxy/spend_tracking/test_spend_event.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_event.py rename to tests/unit/proxy/spend_tracking/test_spend_event.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_event_producer.py b/tests/unit/proxy/spend_tracking/test_spend_event_producer.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_event_producer.py rename to tests/unit/proxy/spend_tracking/test_spend_event_producer.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_log_error_logger.py b/tests/unit/proxy/spend_tracking/test_spend_log_error_logger.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_log_error_logger.py rename to tests/unit/proxy/spend_tracking/test_spend_log_error_logger.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py b/tests/unit/proxy/spend_tracking/test_spend_management_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_management_endpoints.py rename to tests/unit/proxy/spend_tracking/test_spend_management_endpoints.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py b/tests/unit/proxy/spend_tracking/test_spend_query_optimization.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_query_optimization.py rename to tests/unit/proxy/spend_tracking/test_spend_query_optimization.py diff --git a/tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py b/tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py similarity index 100% rename from tests/test_litellm/proxy/spend_tracking/test_spend_tracking_utils.py rename to tests/unit/proxy/spend_tracking/test_spend_tracking_utils.py diff --git a/tests/test_litellm/proxy/test__types.py b/tests/unit/proxy/test__types.py similarity index 100% rename from tests/test_litellm/proxy/test__types.py rename to tests/unit/proxy/test__types.py diff --git a/tests/test_litellm/proxy/test_aiohttp_cleanup_closed.py b/tests/unit/proxy/test_aiohttp_cleanup_closed.py similarity index 100% rename from tests/test_litellm/proxy/test_aiohttp_cleanup_closed.py rename to tests/unit/proxy/test_aiohttp_cleanup_closed.py diff --git a/tests/test_litellm/proxy/test_aiohttp_session_recovery.py b/tests/unit/proxy/test_aiohttp_session_recovery.py similarity index 100% rename from tests/test_litellm/proxy/test_aiohttp_session_recovery.py rename to tests/unit/proxy/test_aiohttp_session_recovery.py diff --git a/tests/test_litellm/proxy/test_api_key_masking_in_errors.py b/tests/unit/proxy/test_api_key_masking_in_errors.py similarity index 100% rename from tests/test_litellm/proxy/test_api_key_masking_in_errors.py rename to tests/unit/proxy/test_api_key_masking_in_errors.py diff --git a/tests/test_litellm/proxy/test_audio_speech_prometheus_hooks.py b/tests/unit/proxy/test_audio_speech_prometheus_hooks.py similarity index 99% rename from tests/test_litellm/proxy/test_audio_speech_prometheus_hooks.py rename to tests/unit/proxy/test_audio_speech_prometheus_hooks.py index 959cb2b1e89..01650e7a77d 100644 --- a/tests/test_litellm/proxy/test_audio_speech_prometheus_hooks.py +++ b/tests/unit/proxy/test_audio_speech_prometheus_hooks.py @@ -44,7 +44,7 @@ def client_no_auth(): cleanup_router_config_variables() filepath = os.path.dirname(os.path.abspath(__file__)) - config_fp = os.path.join(filepath, "test_configs", "test_config_no_auth.yaml") + config_fp = os.path.join(filepath, "test_configs", "test_config_hosted_vllm_embedding.yaml") asyncio.run(initialize(config=config_fp, debug=True)) return TestClient(app) diff --git a/tests/test_litellm/proxy/test_batch_expiry.py b/tests/unit/proxy/test_batch_expiry.py similarity index 100% rename from tests/test_litellm/proxy/test_batch_expiry.py rename to tests/unit/proxy/test_batch_expiry.py diff --git a/tests/test_litellm/proxy/test_batch_metadata_none_fix.py b/tests/unit/proxy/test_batch_metadata_none_fix.py similarity index 100% rename from tests/test_litellm/proxy/test_batch_metadata_none_fix.py rename to tests/unit/proxy/test_batch_metadata_none_fix.py diff --git a/tests/test_litellm/proxy/test_batch_retrieve_bedrock.py b/tests/unit/proxy/test_batch_retrieve_bedrock.py similarity index 100% rename from tests/test_litellm/proxy/test_batch_retrieve_bedrock.py rename to tests/unit/proxy/test_batch_retrieve_bedrock.py diff --git a/tests/test_litellm/proxy/test_batch_x_litellm_model_encoding.py b/tests/unit/proxy/test_batch_x_litellm_model_encoding.py similarity index 100% rename from tests/test_litellm/proxy/test_batch_x_litellm_model_encoding.py rename to tests/unit/proxy/test_batch_x_litellm_model_encoding.py diff --git a/tests/test_litellm/proxy/test_blocked_response_usage.py b/tests/unit/proxy/test_blocked_response_usage.py similarity index 100% rename from tests/test_litellm/proxy/test_blocked_response_usage.py rename to tests/unit/proxy/test_blocked_response_usage.py diff --git a/tests/test_litellm/proxy/test_body_snapshot_callback_params.py b/tests/unit/proxy/test_body_snapshot_callback_params.py similarity index 100% rename from tests/test_litellm/proxy/test_body_snapshot_callback_params.py rename to tests/unit/proxy/test_body_snapshot_callback_params.py diff --git a/tests/test_litellm/proxy/test_budget_reservation.py b/tests/unit/proxy/test_budget_reservation.py similarity index 100% rename from tests/test_litellm/proxy/test_budget_reservation.py rename to tests/unit/proxy/test_budget_reservation.py diff --git a/tests/test_litellm/proxy/test_bug_report_config.py b/tests/unit/proxy/test_bug_report_config.py similarity index 100% rename from tests/test_litellm/proxy/test_bug_report_config.py rename to tests/unit/proxy/test_bug_report_config.py diff --git a/tests/test_litellm/proxy/test_caching_routes.py b/tests/unit/proxy/test_caching_routes.py similarity index 100% rename from tests/test_litellm/proxy/test_caching_routes.py rename to tests/unit/proxy/test_caching_routes.py diff --git a/tests/test_litellm/proxy/test_chat_completion_metadata.py b/tests/unit/proxy/test_chat_completion_metadata.py similarity index 100% rename from tests/test_litellm/proxy/test_chat_completion_metadata.py rename to tests/unit/proxy/test_chat_completion_metadata.py diff --git a/tests/test_litellm/proxy/test_claude_code_marketplace.py b/tests/unit/proxy/test_claude_code_marketplace.py similarity index 100% rename from tests/test_litellm/proxy/test_claude_code_marketplace.py rename to tests/unit/proxy/test_claude_code_marketplace.py diff --git a/tests/test_litellm/proxy/test_collector.py b/tests/unit/proxy/test_collector.py similarity index 100% rename from tests/test_litellm/proxy/test_collector.py rename to tests/unit/proxy/test_collector.py diff --git a/tests/test_litellm/proxy/test_common_request_processing.py b/tests/unit/proxy/test_common_request_processing.py similarity index 100% rename from tests/test_litellm/proxy/test_common_request_processing.py rename to tests/unit/proxy/test_common_request_processing.py diff --git a/tests/test_litellm/proxy/test_component_allowlists.py b/tests/unit/proxy/test_component_allowlists.py similarity index 100% rename from tests/test_litellm/proxy/test_component_allowlists.py rename to tests/unit/proxy/test_component_allowlists.py diff --git a/tests/test_litellm/proxy/test_configs/test_config_no_auth.yaml b/tests/unit/proxy/test_configs/test_config_hosted_vllm_embedding.yaml similarity index 100% rename from tests/test_litellm/proxy/test_configs/test_config_no_auth.yaml rename to tests/unit/proxy/test_configs/test_config_hosted_vllm_embedding.yaml diff --git a/tests/test_litellm/proxy/test_conftest.py b/tests/unit/proxy/test_conftest.py similarity index 100% rename from tests/test_litellm/proxy/test_conftest.py rename to tests/unit/proxy/test_conftest.py diff --git a/tests/test_litellm/proxy/test_cors_config.py b/tests/unit/proxy/test_cors_config.py similarity index 100% rename from tests/test_litellm/proxy/test_cors_config.py rename to tests/unit/proxy/test_cors_config.py diff --git a/tests/test_litellm/proxy/test_custom_proxy.py b/tests/unit/proxy/test_custom_proxy.py similarity index 100% rename from tests/test_litellm/proxy/test_custom_proxy.py rename to tests/unit/proxy/test_custom_proxy.py diff --git a/tests/test_litellm/proxy/test_dynamic_mcp_route.py b/tests/unit/proxy/test_dynamic_mcp_route.py similarity index 100% rename from tests/test_litellm/proxy/test_dynamic_mcp_route.py rename to tests/unit/proxy/test_dynamic_mcp_route.py diff --git a/tests/test_litellm/proxy/test_empty_model_list.py b/tests/unit/proxy/test_empty_model_list.py similarity index 100% rename from tests/test_litellm/proxy/test_empty_model_list.py rename to tests/unit/proxy/test_empty_model_list.py diff --git a/tests/test_litellm/proxy/test_enforce_user_param.py b/tests/unit/proxy/test_enforce_user_param.py similarity index 99% rename from tests/test_litellm/proxy/test_enforce_user_param.py rename to tests/unit/proxy/test_enforce_user_param.py index 1001372aeb5..cca2fbadaa9 100644 --- a/tests/test_litellm/proxy/test_enforce_user_param.py +++ b/tests/unit/proxy/test_enforce_user_param.py @@ -488,5 +488,5 @@ class TestEnforceUserParamEdgeCases: if __name__ == "__main__": - # Run tests with: pytest tests/test_litellm/proxy/test_enforce_user_param.py -v + # Run tests with: pytest tests/unit/proxy/test_enforce_user_param.py -v pytest.main([__file__, "-v"]) diff --git a/tests/test_litellm/proxy/test_fallback_management_endpoints.py b/tests/unit/proxy/test_fallback_management_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/test_fallback_management_endpoints.py rename to tests/unit/proxy/test_fallback_management_endpoints.py diff --git a/tests/test_litellm/proxy/test_fastapi_offline_routes.py b/tests/unit/proxy/test_fastapi_offline_routes.py similarity index 100% rename from tests/test_litellm/proxy/test_fastapi_offline_routes.py rename to tests/unit/proxy/test_fastapi_offline_routes.py diff --git a/tests/test_litellm/proxy/test_filter_models_by_team_access_group.py b/tests/unit/proxy/test_filter_models_by_team_access_group.py similarity index 100% rename from tests/test_litellm/proxy/test_filter_models_by_team_access_group.py rename to tests/unit/proxy/test_filter_models_by_team_access_group.py diff --git a/tests/test_litellm/proxy/test_health_check_functions.py b/tests/unit/proxy/test_health_check_functions.py similarity index 100% rename from tests/test_litellm/proxy/test_health_check_functions.py rename to tests/unit/proxy/test_health_check_functions.py diff --git a/tests/test_litellm/proxy/test_health_check_max_tokens.py b/tests/unit/proxy/test_health_check_max_tokens.py similarity index 100% rename from tests/test_litellm/proxy/test_health_check_max_tokens.py rename to tests/unit/proxy/test_health_check_max_tokens.py diff --git a/tests/test_litellm/proxy/test_init_litellm_callbacks.py b/tests/unit/proxy/test_init_litellm_callbacks.py similarity index 100% rename from tests/test_litellm/proxy/test_init_litellm_callbacks.py rename to tests/unit/proxy/test_init_litellm_callbacks.py diff --git a/tests/test_litellm/proxy/test_langfuse_passthrough_security.py b/tests/unit/proxy/test_langfuse_passthrough_security.py similarity index 100% rename from tests/test_litellm/proxy/test_langfuse_passthrough_security.py rename to tests/unit/proxy/test_langfuse_passthrough_security.py diff --git a/tests/test_litellm/proxy/test_lazy_openapi_snapshot.py b/tests/unit/proxy/test_lazy_openapi_snapshot.py similarity index 100% rename from tests/test_litellm/proxy/test_lazy_openapi_snapshot.py rename to tests/unit/proxy/test_lazy_openapi_snapshot.py diff --git a/tests/test_litellm/proxy/test_litellm_pre_call_utils.py b/tests/unit/proxy/test_litellm_pre_call_utils.py similarity index 100% rename from tests/test_litellm/proxy/test_litellm_pre_call_utils.py rename to tests/unit/proxy/test_litellm_pre_call_utils.py diff --git a/tests/test_litellm/proxy/test_max_budget_env_var.py b/tests/unit/proxy/test_max_budget_env_var.py similarity index 100% rename from tests/test_litellm/proxy/test_max_budget_env_var.py rename to tests/unit/proxy/test_max_budget_env_var.py diff --git a/tests/test_litellm/proxy/test_mcp_asgi_response.py b/tests/unit/proxy/test_mcp_asgi_response.py similarity index 100% rename from tests/test_litellm/proxy/test_mcp_asgi_response.py rename to tests/unit/proxy/test_mcp_asgi_response.py diff --git a/tests/test_litellm/proxy/test_model_based_routing_files_batches.py b/tests/unit/proxy/test_model_based_routing_files_batches.py similarity index 100% rename from tests/test_litellm/proxy/test_model_based_routing_files_batches.py rename to tests/unit/proxy/test_model_based_routing_files_batches.py diff --git a/tests/test_litellm/proxy/test_model_deprecations_endpoint.py b/tests/unit/proxy/test_model_deprecations_endpoint.py similarity index 100% rename from tests/test_litellm/proxy/test_model_deprecations_endpoint.py rename to tests/unit/proxy/test_model_deprecations_endpoint.py diff --git a/tests/test_litellm/proxy/test_model_dump_with_preserved_fields.py b/tests/unit/proxy/test_model_dump_with_preserved_fields.py similarity index 100% rename from tests/test_litellm/proxy/test_model_dump_with_preserved_fields.py rename to tests/unit/proxy/test_model_dump_with_preserved_fields.py diff --git a/tests/test_litellm/proxy/test_model_id_header_propagation.py b/tests/unit/proxy/test_model_id_header_propagation.py similarity index 100% rename from tests/test_litellm/proxy/test_model_id_header_propagation.py rename to tests/unit/proxy/test_model_id_header_propagation.py diff --git a/tests/test_litellm/proxy/test_model_info_default_limits.py b/tests/unit/proxy/test_model_info_default_limits.py similarity index 100% rename from tests/test_litellm/proxy/test_model_info_default_limits.py rename to tests/unit/proxy/test_model_info_default_limits.py diff --git a/tests/test_litellm/proxy/test_model_level_guardrails.py b/tests/unit/proxy/test_model_level_guardrails.py similarity index 100% rename from tests/test_litellm/proxy/test_model_level_guardrails.py rename to tests/unit/proxy/test_model_level_guardrails.py diff --git a/tests/test_litellm/proxy/test_model_list_aliases.py b/tests/unit/proxy/test_model_list_aliases.py similarity index 100% rename from tests/test_litellm/proxy/test_model_list_aliases.py rename to tests/unit/proxy/test_model_list_aliases.py diff --git a/tests/test_litellm/proxy/test_model_list_callback_filter.py b/tests/unit/proxy/test_model_list_callback_filter.py similarity index 100% rename from tests/test_litellm/proxy/test_model_list_callback_filter.py rename to tests/unit/proxy/test_model_list_callback_filter.py diff --git a/tests/test_litellm/proxy/test_model_list_discoverable.py b/tests/unit/proxy/test_model_list_discoverable.py similarity index 100% rename from tests/test_litellm/proxy/test_model_list_discoverable.py rename to tests/unit/proxy/test_model_list_discoverable.py diff --git a/tests/test_litellm/proxy/test_model_list_healthy_only.py b/tests/unit/proxy/test_model_list_healthy_only.py similarity index 100% rename from tests/test_litellm/proxy/test_model_list_healthy_only.py rename to tests/unit/proxy/test_model_list_healthy_only.py diff --git a/tests/test_litellm/proxy/test_modify_response_streaming_passthrough.py b/tests/unit/proxy/test_modify_response_streaming_passthrough.py similarity index 100% rename from tests/test_litellm/proxy/test_modify_response_streaming_passthrough.py rename to tests/unit/proxy/test_modify_response_streaming_passthrough.py diff --git a/tests/test_litellm/proxy/test_native_compaction.py b/tests/unit/proxy/test_native_compaction.py similarity index 100% rename from tests/test_litellm/proxy/test_native_compaction.py rename to tests/unit/proxy/test_native_compaction.py diff --git a/tests/test_litellm/proxy/test_openai_ws_passthrough_routes.py b/tests/unit/proxy/test_openai_ws_passthrough_routes.py similarity index 100% rename from tests/test_litellm/proxy/test_openai_ws_passthrough_routes.py rename to tests/unit/proxy/test_openai_ws_passthrough_routes.py diff --git a/tests/test_litellm/proxy/test_openapi_schema_validation.py b/tests/unit/proxy/test_openapi_schema_validation.py similarity index 100% rename from tests/test_litellm/proxy/test_openapi_schema_validation.py rename to tests/unit/proxy/test_openapi_schema_validation.py diff --git a/tests/test_litellm/proxy/test_plugin_routes.py b/tests/unit/proxy/test_plugin_routes.py similarity index 100% rename from tests/test_litellm/proxy/test_plugin_routes.py rename to tests/unit/proxy/test_plugin_routes.py diff --git a/tests/test_litellm/proxy/test_pointfive_dashboard_config.py b/tests/unit/proxy/test_pointfive_dashboard_config.py similarity index 100% rename from tests/test_litellm/proxy/test_pointfive_dashboard_config.py rename to tests/unit/proxy/test_pointfive_dashboard_config.py diff --git a/tests/test_litellm/proxy/test_pointfive_ui_callback.py b/tests/unit/proxy/test_pointfive_ui_callback.py similarity index 100% rename from tests/test_litellm/proxy/test_pointfive_ui_callback.py rename to tests/unit/proxy/test_pointfive_ui_callback.py diff --git a/tests/test_litellm/proxy/test_pricing_field_strip.py b/tests/unit/proxy/test_pricing_field_strip.py similarity index 100% rename from tests/test_litellm/proxy/test_pricing_field_strip.py rename to tests/unit/proxy/test_pricing_field_strip.py diff --git a/tests/test_litellm/proxy/test_prisma_engine_watchdog.py b/tests/unit/proxy/test_prisma_engine_watchdog.py similarity index 100% rename from tests/test_litellm/proxy/test_prisma_engine_watchdog.py rename to tests/unit/proxy/test_prisma_engine_watchdog.py diff --git a/tests/test_litellm/proxy/test_prisma_migration.py b/tests/unit/proxy/test_prisma_migration.py similarity index 100% rename from tests/test_litellm/proxy/test_prisma_migration.py rename to tests/unit/proxy/test_prisma_migration.py diff --git a/tests/test_litellm/proxy/test_prometheus_cleanup.py b/tests/unit/proxy/test_prometheus_cleanup.py similarity index 100% rename from tests/test_litellm/proxy/test_prometheus_cleanup.py rename to tests/unit/proxy/test_prometheus_cleanup.py diff --git a/tests/test_litellm/proxy/test_prometheus_metrics_server.py b/tests/unit/proxy/test_prometheus_metrics_server.py similarity index 100% rename from tests/test_litellm/proxy/test_prometheus_metrics_server.py rename to tests/unit/proxy/test_prometheus_metrics_server.py diff --git a/tests/test_litellm/proxy/test_provider_url_destination_guard.py b/tests/unit/proxy/test_provider_url_destination_guard.py similarity index 100% rename from tests/test_litellm/proxy/test_provider_url_destination_guard.py rename to tests/unit/proxy/test_provider_url_destination_guard.py diff --git a/tests/test_litellm/proxy/test_proxy_cli.py b/tests/unit/proxy/test_proxy_cli.py similarity index 99% rename from tests/test_litellm/proxy/test_proxy_cli.py rename to tests/unit/proxy/test_proxy_cli.py index a275dd62400..7007189aab9 100644 --- a/tests/test_litellm/proxy/test_proxy_cli.py +++ b/tests/unit/proxy/test_proxy_cli.py @@ -2575,7 +2575,7 @@ class TestWorkerStartupHooks: from litellm.proxy.proxy_server import proxy_startup_event env_overrides = { - "LITELLM_WORKER_STARTUP_HOOKS": "tests.test_litellm.proxy.test_proxy_cli:_dummy_hook", + "LITELLM_WORKER_STARTUP_HOOKS": "tests.unit.proxy.test_proxy_cli:_dummy_hook", } # Remove DATABASE_URL to avoid real DB setup clean_env = { @@ -2603,7 +2603,7 @@ class TestWorkerStartupHooks: from litellm.proxy.proxy_server import proxy_startup_event env_overrides = { - "LITELLM_WORKER_STARTUP_HOOKS": "tests.test_litellm.proxy.test_proxy_cli:_dummy_async_hook", + "LITELLM_WORKER_STARTUP_HOOKS": "tests.unit.proxy.test_proxy_cli:_dummy_async_hook", } clean_env = { k: v @@ -2627,7 +2627,7 @@ class TestWorkerStartupHooks: from litellm.proxy.proxy_server import proxy_startup_event env_overrides = { - "LITELLM_WORKER_STARTUP_HOOKS": "tests.test_litellm.proxy.test_proxy_cli:_failing_hook", + "LITELLM_WORKER_STARTUP_HOOKS": "tests.unit.proxy.test_proxy_cli:_failing_hook", } clean_env = { k: v @@ -2663,8 +2663,8 @@ class TestWorkerStartupHooks: from litellm.proxy.proxy_server import proxy_startup_event hooks = ( - "tests.test_litellm.proxy.test_proxy_cli:_dummy_hook," - "tests.test_litellm.proxy.test_proxy_cli:_dummy_async_hook" + "tests.unit.proxy.test_proxy_cli:_dummy_hook," + "tests.unit.proxy.test_proxy_cli:_dummy_async_hook" ) env_overrides = { "LITELLM_WORKER_STARTUP_HOOKS": hooks, diff --git a/tests/test_litellm/proxy/test_proxy_logging_hook_detection.py b/tests/unit/proxy/test_proxy_logging_hook_detection.py similarity index 100% rename from tests/test_litellm/proxy/test_proxy_logging_hook_detection.py rename to tests/unit/proxy/test_proxy_logging_hook_detection.py diff --git a/tests/test_litellm/proxy/test_proxy_types.py b/tests/unit/proxy/test_proxy_types.py similarity index 100% rename from tests/test_litellm/proxy/test_proxy_types.py rename to tests/unit/proxy/test_proxy_types.py diff --git a/tests/test_litellm/proxy/test_pyroscope.py b/tests/unit/proxy/test_pyroscope.py similarity index 100% rename from tests/test_litellm/proxy/test_pyroscope.py rename to tests/unit/proxy/test_pyroscope.py diff --git a/tests/test_litellm/proxy/test_read_model_list.py b/tests/unit/proxy/test_read_model_list.py similarity index 100% rename from tests/test_litellm/proxy/test_read_model_list.py rename to tests/unit/proxy/test_read_model_list.py diff --git a/tests/test_litellm/proxy/test_redis_auth_cache_flag.py b/tests/unit/proxy/test_redis_auth_cache_flag.py similarity index 98% rename from tests/test_litellm/proxy/test_redis_auth_cache_flag.py rename to tests/unit/proxy/test_redis_auth_cache_flag.py index 573bfc40c96..cb600bbb5fd 100644 --- a/tests/test_litellm/proxy/test_redis_auth_cache_flag.py +++ b/tests/unit/proxy/test_redis_auth_cache_flag.py @@ -65,6 +65,7 @@ def _patched_init_cache(litellm_settings: dict, cache_params: dict): fresh_user_cache = DualCache() fresh_spend_cache = DualCache() fresh_cli_sso_cache = DualCache() + fresh_config_cache = DualCache() enable_redis_auth_cache = litellm_settings.get("enable_redis_auth_cache", False) @@ -72,6 +73,7 @@ def _patched_init_cache(litellm_settings: dict, cache_params: dict): patch.object(ps, "user_api_key_cache", fresh_user_cache), patch.object(ps, "spend_counter_cache", fresh_spend_cache), patch.object(ps, "cli_sso_session_cache", fresh_cli_sso_cache), + patch.object(ps, "litellm_config_cache", fresh_config_cache), patch.object(ps, "llm_router", None), # Cache is locally imported inside _init_cache: patch it at source. patch("litellm.Cache", return_value=mock_litellm_cache), diff --git a/tests/test_litellm/proxy/test_response_model_sanitization.py b/tests/unit/proxy/test_response_model_sanitization.py similarity index 100% rename from tests/test_litellm/proxy/test_response_model_sanitization.py rename to tests/unit/proxy/test_response_model_sanitization.py diff --git a/tests/test_litellm/proxy/test_route_a2a_models.py b/tests/unit/proxy/test_route_a2a_models.py similarity index 100% rename from tests/test_litellm/proxy/test_route_a2a_models.py rename to tests/unit/proxy/test_route_a2a_models.py diff --git a/tests/test_litellm/proxy/test_route_llm_request.py b/tests/unit/proxy/test_route_llm_request.py similarity index 100% rename from tests/test_litellm/proxy/test_route_llm_request.py rename to tests/unit/proxy/test_route_llm_request.py diff --git a/tests/test_litellm/proxy/test_route_priority.py b/tests/unit/proxy/test_route_priority.py similarity index 100% rename from tests/test_litellm/proxy/test_route_priority.py rename to tests/unit/proxy/test_route_priority.py diff --git a/tests/test_litellm/proxy/test_sensitive_route_auth.py b/tests/unit/proxy/test_sensitive_route_auth.py similarity index 100% rename from tests/test_litellm/proxy/test_sensitive_route_auth.py rename to tests/unit/proxy/test_sensitive_route_auth.py diff --git a/tests/test_litellm/proxy/test_shared_health_check.py b/tests/unit/proxy/test_shared_health_check.py similarity index 100% rename from tests/test_litellm/proxy/test_shared_health_check.py rename to tests/unit/proxy/test_shared_health_check.py diff --git a/tests/test_litellm/proxy/test_spend_log_cleanup.py b/tests/unit/proxy/test_spend_log_cleanup.py similarity index 100% rename from tests/test_litellm/proxy/test_spend_log_cleanup.py rename to tests/unit/proxy/test_spend_log_cleanup.py diff --git a/tests/test_litellm/proxy/test_swagger_chat_completions.py b/tests/unit/proxy/test_swagger_chat_completions.py similarity index 100% rename from tests/test_litellm/proxy/test_swagger_chat_completions.py rename to tests/unit/proxy/test_swagger_chat_completions.py diff --git a/tests/test_litellm/proxy/test_team_member_update.py b/tests/unit/proxy/test_team_member_update.py similarity index 100% rename from tests/test_litellm/proxy/test_team_member_update.py rename to tests/unit/proxy/test_team_member_update.py diff --git a/tests/test_litellm/proxy/test_team_org_move.py b/tests/unit/proxy/test_team_org_move.py similarity index 100% rename from tests/test_litellm/proxy/test_team_org_move.py rename to tests/unit/proxy/test_team_org_move.py diff --git a/tests/test_litellm/proxy/test_tools_allowlist_enforcement.py b/tests/unit/proxy/test_tools_allowlist_enforcement.py similarity index 100% rename from tests/test_litellm/proxy/test_tools_allowlist_enforcement.py rename to tests/unit/proxy/test_tools_allowlist_enforcement.py diff --git a/tests/test_litellm/proxy/test_tracing_endpoints.py b/tests/unit/proxy/test_tracing_endpoints.py similarity index 100% rename from tests/test_litellm/proxy/test_tracing_endpoints.py rename to tests/unit/proxy/test_tracing_endpoints.py diff --git a/tests/test_litellm/proxy/test_update_llm_router_resilience.py b/tests/unit/proxy/test_update_llm_router_resilience.py similarity index 100% rename from tests/test_litellm/proxy/test_update_llm_router_resilience.py rename to tests/unit/proxy/test_update_llm_router_resilience.py diff --git a/tests/test_litellm/proxy/test_zerobus_dashboard_config.py b/tests/unit/proxy/test_zerobus_dashboard_config.py similarity index 100% rename from tests/test_litellm/proxy/test_zerobus_dashboard_config.py rename to tests/unit/proxy/test_zerobus_dashboard_config.py diff --git a/tests/unit/proxy/types_utils/__init__.py b/tests/unit/proxy/types_utils/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tests/test_litellm/proxy/types_utils/test_db_overlay_remote_module_scrub.py b/tests/unit/proxy/types_utils/test_db_overlay_remote_module_scrub.py similarity index 100% rename from tests/test_litellm/proxy/types_utils/test_db_overlay_remote_module_scrub.py rename to tests/unit/proxy/types_utils/test_db_overlay_remote_module_scrub.py diff --git a/tests/test_litellm/proxy/types_utils/test_get_instance_fn_runtime_gate.py b/tests/unit/proxy/types_utils/test_get_instance_fn_runtime_gate.py similarity index 100% rename from tests/test_litellm/proxy/types_utils/test_get_instance_fn_runtime_gate.py rename to tests/unit/proxy/types_utils/test_get_instance_fn_runtime_gate.py