Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(proxy): move proxy_server, _experimental and db tests into tests/unit/proxy (#44012)

devin-ai-integration[bot]24584d3d3dc6
diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml
index e8483771569..a05c26eef7d 100644
--- a/.github/workflows/test-unit.yml
+++ b/.github/workflows/test-unit.yml
@@ -187,7 +187,7 @@ jobs:
- shard: proxy-server
artifact-name: proxy-server
- test-path: "tests/test_litellm/proxy/proxy_server"
+ test-path: "tests/unit/proxy/proxy_server"
workers: 4
reruns: 2
timeout-minutes: 60
@@ -196,11 +196,14 @@ jobs:
- shard: proxy-infra
artifact-name: proxy-infra
test-path: >-
- tests/test_litellm/proxy/db
+ 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/test_litellm/proxy/pass_through_endpoints
- tests/test_litellm/proxy/_experimental
+ 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
diff --git a/.gitignore b/.gitignore
index 7da917ce450..ac8e2919372 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,7 +104,7 @@ litellm_config.yaml
.cursor
litellm/proxy/to_delete_loadtest_work/*
update_model_cost_map.py
-tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py
+tests/unit/proxy/_experimental/mcp_server/test_mcp_server_manager.py
scripts/test_vertex_ai_search.py
LAZY_LOADING_IMPROVEMENTS.md
STABILIZATION_TODO.md
diff --git a/Makefile b/Makefile
index ed1f9e3e1e5..421b811d8f3 100644
--- a/Makefile
+++ b/Makefile
@@ -324,10 +324,10 @@ test-unit-proxy-guardrails: install-test-deps
$(UV_RUN) pytest tests/unit/proxy/guardrails tests/unit/proxy/management_endpoints tests/unit/proxy/management_helpers --tb=short -vv -n 4 --durations=20
test-unit-proxy-core: install-test-deps
- $(UV_RUN) pytest tests/unit/proxy/auth tests/unit/proxy/client tests/test_litellm/proxy/db tests/unit/proxy/hooks tests/unit/proxy/policy_engine --tb=short -vv -n 4 --durations=20
+ $(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
test-unit-proxy-misc: install-test-deps
- $(UV_RUN) pytest tests/test_litellm/proxy/_experimental 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/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
test-unit-integrations: install-test-deps
$(UV_RUN) pytest tests/unit/integrations --tb=short -vv -n 4 --durations=20
diff --git a/tests/proxy_behavior/spend/test_autorouter_session_rollup.py b/tests/proxy_behavior/spend/test_autorouter_session_rollup.py
index 9ef42f5dc7a..effb5ca83ed 100644
--- a/tests/proxy_behavior/spend/test_autorouter_session_rollup.py
+++ b/tests/proxy_behavior/spend/test_autorouter_session_rollup.py
@@ -2,7 +2,7 @@
Behavior tests for the LiteLLM_AutoRouterSession conditional upsert and the benchmarks
aggregate, against a real Postgres. The classification lives in SQL, so these tests are
the ones that exercise it; the builder and flush contracts are unit-tested in
-tests/test_litellm/proxy/db/test_autorouter_session_rollup.py.
+tests/unit/proxy/db/test_autorouter_session_rollup.py.
"""
import asyncio
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py b/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py
deleted file mode 100644
index 76e92efd31a..00000000000
--- a/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import os
-
-import pytest
-
-
[email protected](autouse=True)
-def _hermetic_mcp_server_registry():
- """Restore the singleton ``global_mcp_server_manager``'s registry state around every
- test, so entries seeded by one test never leak into another on a shared shard."""
- from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
- global_mcp_server_manager,
- )
-
- saved_registry = dict(global_mcp_server_manager.registry)
- saved_config_servers = dict(global_mcp_server_manager.config_mcp_servers)
- saved_tool_mapping = dict(global_mcp_server_manager.tool_name_to_mcp_server_name_mapping)
- saved_oauth_slots = global_mcp_server_manager._oauth_discovery_slots
- try:
- yield
- finally:
- global_mcp_server_manager.registry.clear()
- global_mcp_server_manager.registry.update(saved_registry)
- global_mcp_server_manager.config_mcp_servers.clear()
- global_mcp_server_manager.config_mcp_servers.update(saved_config_servers)
- global_mcp_server_manager.tool_name_to_mcp_server_name_mapping.clear()
- global_mcp_server_manager.tool_name_to_mcp_server_name_mapping.update(saved_tool_mapping)
- global_mcp_server_manager._oauth_discovery_slots = saved_oauth_slots
-
-
[email protected](autouse=True)
-def _hermetic_server_root_path():
- """Isolate MCP discovery tests from a leaked ``SERVER_ROOT_PATH``.
-
- ``tests/test_litellm/proxy/test_custom_proxy.py`` sets ``SERVER_ROOT_PATH`` at import time
- (its app mounts under a custom path) and never restores it, so in a shared shard the value
- leaks into this process. The discovery routes and the 401 challenges read it, so a leaked
- value would silently rewrite every ``resource_metadata`` URL and make these tests depend on
- shard ordering. Clearing it here pins the default (root-mounted) deployment; a test that
- exercises a sub-path deployment sets the value explicitly within its own body.
- """
- saved = os.environ.pop("SERVER_ROOT_PATH", None)
- try:
- yield
- finally:
- if saved is not None:
- os.environ["SERVER_ROOT_PATH"] = saved
-
-
-def config_only_mcp_manager_factory():
- from litellm.proxy._experimental.mcp_server.mcp_server_manager import MCPServerManager
-
- class ConfigOnlyManager(MCPServerManager):
- def initialize_tool_name_to_mcp_server_name_mapping(self):
- return None
-
- return ConfigOnlyManager
-
-
-def _mcp_request_ctx():
- def _mcp_request_ctx(**overrides):
- from types import SimpleNamespace
-
- from mcp.server.context import ServerRequestContext
-
- kwargs = {
- "session": SimpleNamespace(),
- "lifespan_context": {},
- "protocol_version": "2025-06-18",
- "method": "",
- "params": None,
- "request_id": 1,
- "meta": None,
- "request": None,
- }
- kwargs.update(overrides)
- return ServerRequestContext(**kwargs)
-
- return _mcp_request_ctx
diff --git a/tests/test_litellm/proxy/proxy_server/__init__.py b/tests/unit/proxy/_experimental/mcp_server/auth/__init__.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/__init__.py
rename to tests/unit/proxy/_experimental/mcp_server/auth/__init__.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_managed_agent_access.py b/tests/unit/proxy/_experimental/mcp_server/auth/test_managed_agent_access.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/auth/test_managed_agent_access.py
rename to tests/unit/proxy/_experimental/mcp_server/auth/test_managed_agent_access.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_token_endpoint_auth.py b/tests/unit/proxy/_experimental/mcp_server/auth/test_token_endpoint_auth.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/auth/test_token_endpoint_auth.py
rename to tests/unit/proxy/_experimental/mcp_server/auth/test_token_endpoint_auth.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py b/tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py
rename to tests/unit/proxy/_experimental/mcp_server/auth/test_user_api_key_auth_mcp.py
diff --git a/tests/unit/proxy/_experimental/mcp_server/faults/__init__.py b/tests/unit/proxy/_experimental/mcp_server/faults/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/faults/test_classify.py b/tests/unit/proxy/_experimental/mcp_server/faults/test_classify.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/faults/test_classify.py
rename to tests/unit/proxy/_experimental/mcp_server/faults/test_classify.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/faults/test_list_outcomes.py b/tests/unit/proxy/_experimental/mcp_server/faults/test_list_outcomes.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/faults/test_list_outcomes.py
rename to tests/unit/proxy/_experimental/mcp_server/faults/test_list_outcomes.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/faults/test_render_oauth.py b/tests/unit/proxy/_experimental/mcp_server/faults/test_render_oauth.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/faults/test_render_oauth.py
rename to tests/unit/proxy/_experimental/mcp_server/faults/test_render_oauth.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/faults/test_traversal.py b/tests/unit/proxy/_experimental/mcp_server/faults/test_traversal.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/faults/test_traversal.py
rename to tests/unit/proxy/_experimental/mcp_server/faults/test_traversal.py
diff --git a/tests/unit/proxy/_experimental/mcp_server/guardrail_translation/__init__.py b/tests/unit/proxy/_experimental/mcp_server/guardrail_translation/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/guardrail_translation/test_mcp_guardrail_handler.py b/tests/unit/proxy/_experimental/mcp_server/guardrail_translation/test_mcp_guardrail_handler.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/guardrail_translation/test_mcp_guardrail_handler.py
rename to tests/unit/proxy/_experimental/mcp_server/guardrail_translation/test_mcp_guardrail_handler.py
diff --git a/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/__init__.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_adapter.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_adapter.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_adapter.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_adapter.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_authz_code_refresher.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_authz_code_refresher.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_authz_code_refresher.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_authz_code_refresher.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_bridge_credentials.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_client_credentials.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_client_credentials.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_client_credentials.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_client_credentials.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_dual_cache_token_backend.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_dual_cache_token_backend.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_dual_cache_token_backend.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_dual_cache_token_backend.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_envelope.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_envelope.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_envelope.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_envelope.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_httpx_auth.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_httpx_auth.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_httpx_auth.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_httpx_auth.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_oauth_token_store.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_oauth_token_store.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_oauth_token_store.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_oauth_token_store.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_per_user_oauth_store.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_per_user_oauth_store.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_per_user_oauth_store.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_per_user_oauth_store.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_presented_token_store.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_presented_token_store.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_presented_token_store.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_presented_token_store.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_redis_distributed_lock.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_redis_distributed_lock.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_redis_distributed_lock.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_redis_distributed_lock.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_redis_refresh_coordinator.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_redis_refresh_coordinator.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_redis_refresh_coordinator.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_redis_refresh_coordinator.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_resolver.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_resolver.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_resolver.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_resolver.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_result.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_result.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_result.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_result.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_session_credentials.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_session_credentials.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_session_credentials.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_session_credentials.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_session_token.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_session_token.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_session_token.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_session_token.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_refresher.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_refresher.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_refresher.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_refresher.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_store.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_store.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_store.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_sso_assertion_store.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_cache_codec.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_cache_codec.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_cache_codec.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_cache_codec.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_endpoint.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_endpoint.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_endpoint.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_endpoint.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchange_provider.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchange_provider.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchange_provider.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchange_provider.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchanger.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchanger.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchanger.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_token_exchanger.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_types.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_types.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_types.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_types.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_v2_token_store.py b/tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_v2_token_store.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/outbound_credentials/test_v2_token_store.py
rename to tests/unit/proxy/_experimental/mcp_server/outbound_credentials/test_v2_token_store.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_byok_credential_cache.py b/tests/unit/proxy/_experimental/mcp_server/test_byok_credential_cache.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_byok_credential_cache.py
rename to tests/unit/proxy/_experimental/mcp_server/test_byok_credential_cache.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_byok_oauth_endpoints.py b/tests/unit/proxy/_experimental/mcp_server/test_byok_oauth_endpoints.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_byok_oauth_endpoints.py
rename to tests/unit/proxy/_experimental/mcp_server/test_byok_oauth_endpoints.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_callback_oauth_error_responses.py b/tests/unit/proxy/_experimental/mcp_server/test_callback_oauth_error_responses.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_callback_oauth_error_responses.py
rename to tests/unit/proxy/_experimental/mcp_server/test_callback_oauth_error_responses.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_capabilities.py b/tests/unit/proxy/_experimental/mcp_server/test_capabilities.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_capabilities.py
rename to tests/unit/proxy/_experimental/mcp_server/test_capabilities.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_client_allowlist.py b/tests/unit/proxy/_experimental/mcp_server/test_client_allowlist.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_client_allowlist.py
rename to tests/unit/proxy/_experimental/mcp_server/test_client_allowlist.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_contracts.py b/tests/unit/proxy/_experimental/mcp_server/test_contracts.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_contracts.py
rename to tests/unit/proxy/_experimental/mcp_server/test_contracts.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_db_credentials.py b/tests/unit/proxy/_experimental/mcp_server/test_db_credentials.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_db_credentials.py
rename to tests/unit/proxy/_experimental/mcp_server/test_db_credentials.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py b/tests/unit/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
rename to tests/unit/proxy/_experimental/mcp_server/test_discoverable_endpoints.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_gateway_dcr_flow.py b/tests/unit/proxy/_experimental/mcp_server/test_gateway_dcr_flow.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_gateway_dcr_flow.py
rename to tests/unit/proxy/_experimental/mcp_server/test_gateway_dcr_flow.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_idp_token_exchange.py b/tests/unit/proxy/_experimental/mcp_server/test_idp_token_exchange.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_idp_token_exchange.py
rename to tests/unit/proxy/_experimental/mcp_server/test_idp_token_exchange.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_is_tool_name_prefixed.py b/tests/unit/proxy/_experimental/mcp_server/test_is_tool_name_prefixed.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_is_tool_name_prefixed.py
rename to tests/unit/proxy/_experimental/mcp_server/test_is_tool_name_prefixed.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py b/tests/unit/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py
rename to tests/unit/proxy/_experimental/mcp_server/test_jwt_mcp_enforcement.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_simple.py b/tests/unit/proxy/_experimental/mcp_server/test_jwt_mcp_simple.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_jwt_mcp_simple.py
rename to tests/unit/proxy/_experimental/mcp_server/test_jwt_mcp_simple.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_block_recording.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_block_recording.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_block_recording.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_block_recording.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_cost_calculator.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_cost_calculator.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_cost_calculator.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_cost_calculator.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_custom_fields.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_custom_fields.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_custom_fields.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_debug.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_debug.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_debug.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_debug.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_discovery.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_discovery.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_discovery.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_elicitation_handler.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_elicitation_handler.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_elicitation_handler.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_elicitation_handler.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_env_vars.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_env_vars.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_env_vars.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_env_vars.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_guardrail_usage_monitor.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_guardrail_usage_monitor.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_guardrail_usage_monitor.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_guardrail_usage_monitor.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_header_alias_utils.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_header_alias_utils.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_header_alias_utils.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_header_alias_utils.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_hook_extra_headers.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_hook_extra_headers.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_hook_extra_headers.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_hook_extra_headers.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_max_concurrent_requests.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_max_concurrent_requests.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_max_concurrent_requests.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_max_concurrent_requests.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_metadata_preservation.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_metadata_preservation.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_metadata_preservation.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_metadata_preservation.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_cold_start.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_cold_start.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_cold_start.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_cold_start.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_tools.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_tools.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_tools.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_oauth_passthrough_tools.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_partial_update.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_partial_update.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_partial_update.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_partial_update.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_proxy_mode.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_proxy_mode.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_proxy_mode.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_proxy_mode.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_completion_flow.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_completion_flow.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_completion_flow.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_completion_flow.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_model_access.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_model_access.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_model_access.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_model_access.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_model_resolution.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_model_resolution.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_model_resolution.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_model_resolution.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_priority_selection.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_priority_selection.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_priority_selection.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_priority_selection.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_request_builder.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_request_builder.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_request_builder.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_request_builder.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_response_conversion.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_response_conversion.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_response_conversion.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_response_conversion.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_tool_conversion.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_tool_conversion.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sampling_tool_conversion.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sampling_tool_conversion.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_server_manager.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_server_manager.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_session_logging.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_session_logging.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_session_logging.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_session_logging.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sigv4_auth.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_sigv4_auth.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_sigv4_auth.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_sigv4_auth.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_stale_session.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_stale_session.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_stale_session.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_stale_session.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_tool_search.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_tool_search.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_tool_search.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_tool_search.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_toolset_scope.py b/tests/unit/proxy/_experimental/mcp_server/test_mcp_toolset_scope.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_toolset_scope.py
rename to tests/unit/proxy/_experimental/mcp_server/test_mcp_toolset_scope.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_oauth2_flow_backfill.py b/tests/unit/proxy/_experimental/mcp_server/test_oauth2_flow_backfill.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_oauth2_flow_backfill.py
rename to tests/unit/proxy/_experimental/mcp_server/test_oauth2_flow_backfill.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_oauth2_token_cache.py b/tests/unit/proxy/_experimental/mcp_server/test_oauth2_token_cache.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_oauth2_token_cache.py
rename to tests/unit/proxy/_experimental/mcp_server/test_oauth2_token_cache.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_oauth_identity_binding.py b/tests/unit/proxy/_experimental/mcp_server/test_oauth_identity_binding.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_oauth_identity_binding.py
rename to tests/unit/proxy/_experimental/mcp_server/test_oauth_identity_binding.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_oauth_issuer_stamp_backfill.py b/tests/unit/proxy/_experimental/mcp_server/test_oauth_issuer_stamp_backfill.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_oauth_issuer_stamp_backfill.py
rename to tests/unit/proxy/_experimental/mcp_server/test_oauth_issuer_stamp_backfill.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_to_mcp_generator.py b/tests/unit/proxy/_experimental/mcp_server/test_openapi_to_mcp_generator.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_to_mcp_generator.py
rename to tests/unit/proxy/_experimental/mcp_server/test_openapi_to_mcp_generator.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_tool_auth.py b/tests/unit/proxy/_experimental/mcp_server/test_openapi_tool_auth.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_openapi_tool_auth.py
rename to tests/unit/proxy/_experimental/mcp_server/test_openapi_tool_auth.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_operations.py b/tests/unit/proxy/_experimental/mcp_server/test_operations.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_operations.py
rename to tests/unit/proxy/_experimental/mcp_server/test_operations.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_proxy_api_credentials.py b/tests/unit/proxy/_experimental/mcp_server/test_proxy_api_credentials.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_proxy_api_credentials.py
rename to tests/unit/proxy/_experimental/mcp_server/test_proxy_api_credentials.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py b/tests/unit/proxy/_experimental/mcp_server/test_rest_endpoints.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py
rename to tests/unit/proxy/_experimental/mcp_server/test_rest_endpoints.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_result_conversion.py b/tests/unit/proxy/_experimental/mcp_server/test_result_conversion.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_result_conversion.py
rename to tests/unit/proxy/_experimental/mcp_server/test_result_conversion.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_semantic_tool_filter.py b/tests/unit/proxy/_experimental/mcp_server/test_semantic_tool_filter.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_semantic_tool_filter.py
rename to tests/unit/proxy/_experimental/mcp_server/test_semantic_tool_filter.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_server_resolution.py b/tests/unit/proxy/_experimental/mcp_server/test_server_resolution.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_server_resolution.py
rename to tests/unit/proxy/_experimental/mcp_server/test_server_resolution.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_short_mcp_tool_prefix.py b/tests/unit/proxy/_experimental/mcp_server/test_short_mcp_tool_prefix.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_short_mcp_tool_prefix.py
rename to tests/unit/proxy/_experimental/mcp_server/test_short_mcp_tool_prefix.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_ui_session_utils.py b/tests/unit/proxy/_experimental/mcp_server/test_ui_session_utils.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_ui_session_utils.py
rename to tests/unit/proxy/_experimental/mcp_server/test_ui_session_utils.py
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_utils.py b/tests/unit/proxy/_experimental/mcp_server/test_utils.py
similarity index 100%
rename from tests/test_litellm/proxy/_experimental/mcp_server/test_utils.py
rename to tests/unit/proxy/_experimental/mcp_server/test_utils.py
diff --git a/tests/unit/proxy/conftest.py b/tests/unit/proxy/conftest.py
index 0e8acf3b905..23b4b6078f7 100644
--- a/tests/unit/proxy/conftest.py
+++ b/tests/unit/proxy/conftest.py
@@ -56,7 +56,7 @@ def _snapshot_mutable_state(module):
continue
if value is None or isinstance(value, _SNAPSHOT_TYPES):
try:
- snapshot[attr] = copy.deepcopy(value)
+ snapshot[attr] = _restored_value(value)
except Exception as exc:
warnings.warn(
f"conftest: could not snapshot {module.__name__}.{attr}: {exc}",
@@ -65,10 +65,25 @@ def _snapshot_mutable_state(module):
return snapshot
+_MUTABLE_CONTAINERS = (list, dict, set, bytearray)
+
+
+def _holds_mutable_container(value) -> bool:
+ if isinstance(value, _MUTABLE_CONTAINERS):
+ return True
+ if isinstance(value, tuple):
+ return any(_holds_mutable_container(element) for element in value)
+ return False
+
+
+def _restored_value(value):
+ return copy.deepcopy(value) if _holds_mutable_container(value) else value
+
+
def _restore_mutable_state(module, snapshot):
for attr, default in snapshot.items():
try:
- setattr(module, attr, copy.deepcopy(default))
+ setattr(module, attr, _restored_value(default))
except Exception as exc:
warnings.warn(
f"conftest: could not restore {module.__name__}.{attr}: {exc}",
diff --git a/tests/test_litellm/proxy/db/conftest.py b/tests/unit/proxy/db/conftest.py
similarity index 100%
rename from tests/test_litellm/proxy/db/conftest.py
rename to tests/unit/proxy/db/conftest.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py b/tests/unit/proxy/db/db_transaction_queue/test_base_update_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_base_update_queue.py
rename to tests/unit/proxy/db/db_transaction_queue/test_base_update_queue.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_daily_spend_update_queue.py b/tests/unit/proxy/db/db_transaction_queue/test_daily_spend_update_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_daily_spend_update_queue.py
rename to tests/unit/proxy/db/db_transaction_queue/test_daily_spend_update_queue.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_pod_lock_manager.py b/tests/unit/proxy/db/db_transaction_queue/test_pod_lock_manager.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_pod_lock_manager.py
rename to tests/unit/proxy/db/db_transaction_queue/test_pod_lock_manager.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_redis_update_buffer.py b/tests/unit/proxy/db/db_transaction_queue/test_redis_update_buffer.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_redis_update_buffer.py
rename to tests/unit/proxy/db/db_transaction_queue/test_redis_update_buffer.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_spend_logs_partition_manager.py b/tests/unit/proxy/db/db_transaction_queue/test_spend_logs_partition_manager.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_spend_logs_partition_manager.py
rename to tests/unit/proxy/db/db_transaction_queue/test_spend_logs_partition_manager.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_spend_update_queue.py b/tests/unit/proxy/db/db_transaction_queue/test_spend_update_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_spend_update_queue.py
rename to tests/unit/proxy/db/db_transaction_queue/test_spend_update_queue.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_tool_discovery_queue.py b/tests/unit/proxy/db/db_transaction_queue/test_tool_discovery_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_tool_discovery_queue.py
rename to tests/unit/proxy/db/db_transaction_queue/test_tool_discovery_queue.py
diff --git a/tests/test_litellm/proxy/db/db_transaction_queue/test_window_spend_update_queue.py b/tests/unit/proxy/db/db_transaction_queue/test_window_spend_update_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/db/db_transaction_queue/test_window_spend_update_queue.py
rename to tests/unit/proxy/db/db_transaction_queue/test_window_spend_update_queue.py
diff --git a/tests/unit/proxy/db/mcp_server/__init__.py b/tests/unit/proxy/db/mcp_server/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/proxy/db/mcp_server/test_db.py b/tests/unit/proxy/db/mcp_server/test_db.py
similarity index 100%
rename from tests/test_litellm/proxy/db/mcp_server/test_db.py
rename to tests/unit/proxy/db/mcp_server/test_db.py
diff --git a/tests/test_litellm/proxy/db/test_autorouter_session_rollup.py b/tests/unit/proxy/db/test_autorouter_session_rollup.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_autorouter_session_rollup.py
rename to tests/unit/proxy/db/test_autorouter_session_rollup.py
diff --git a/tests/test_litellm/proxy/db/test_budget_window_spend_writer.py b/tests/unit/proxy/db/test_budget_window_spend_writer.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_budget_window_spend_writer.py
rename to tests/unit/proxy/db/test_budget_window_spend_writer.py
diff --git a/tests/test_litellm/proxy/db/test_check_migration.py b/tests/unit/proxy/db/test_check_migration.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_check_migration.py
rename to tests/unit/proxy/db/test_check_migration.py
diff --git a/tests/test_litellm/proxy/db/test_create_views.py b/tests/unit/proxy/db/test_create_views.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_create_views.py
rename to tests/unit/proxy/db/test_create_views.py
diff --git a/tests/test_litellm/proxy/db/test_daily_spend_bulk_upsert.py b/tests/unit/proxy/db/test_daily_spend_bulk_upsert.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_daily_spend_bulk_upsert.py
rename to tests/unit/proxy/db/test_daily_spend_bulk_upsert.py
diff --git a/tests/test_litellm/proxy/db/test_db_lookup_gate.py b/tests/unit/proxy/db/test_db_lookup_gate.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_db_lookup_gate.py
rename to tests/unit/proxy/db/test_db_lookup_gate.py
diff --git a/tests/test_litellm/proxy/db/test_db_spend_update_writer.py b/tests/unit/proxy/db/test_db_spend_update_writer.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_db_spend_update_writer.py
rename to tests/unit/proxy/db/test_db_spend_update_writer.py
diff --git a/tests/test_litellm/proxy/db/test_db_url_settings.py b/tests/unit/proxy/db/test_db_url_settings.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_db_url_settings.py
rename to tests/unit/proxy/db/test_db_url_settings.py
diff --git a/tests/test_litellm/proxy/db/test_exception_handler.py b/tests/unit/proxy/db/test_exception_handler.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_exception_handler.py
rename to tests/unit/proxy/db/test_exception_handler.py
diff --git a/tests/test_litellm/proxy/db/test_exception_handler_reconnect_retry.py b/tests/unit/proxy/db/test_exception_handler_reconnect_retry.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_exception_handler_reconnect_retry.py
rename to tests/unit/proxy/db/test_exception_handler_reconnect_retry.py
diff --git a/tests/test_litellm/proxy/db/test_gateway_request_tracking.py b/tests/unit/proxy/db/test_gateway_request_tracking.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_gateway_request_tracking.py
rename to tests/unit/proxy/db/test_gateway_request_tracking.py
diff --git a/tests/test_litellm/proxy/db/test_health_check_latest.py b/tests/unit/proxy/db/test_health_check_latest.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_health_check_latest.py
rename to tests/unit/proxy/db/test_health_check_latest.py
diff --git a/tests/test_litellm/proxy/db/test_master_key_migration.py b/tests/unit/proxy/db/test_master_key_migration.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_master_key_migration.py
rename to tests/unit/proxy/db/test_master_key_migration.py
diff --git a/tests/test_litellm/proxy/db/test_model_access_group_spend.py b/tests/unit/proxy/db/test_model_access_group_spend.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_model_access_group_spend.py
rename to tests/unit/proxy/db/test_model_access_group_spend.py
diff --git a/tests/test_litellm/proxy/db/test_model_insights_tasks.py b/tests/unit/proxy/db/test_model_insights_tasks.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_model_insights_tasks.py
rename to tests/unit/proxy/db/test_model_insights_tasks.py
diff --git a/tests/test_litellm/proxy/db/test_model_usage_rollup.py b/tests/unit/proxy/db/test_model_usage_rollup.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_model_usage_rollup.py
rename to tests/unit/proxy/db/test_model_usage_rollup.py
diff --git a/tests/test_litellm/proxy/db/test_pgbouncer.py b/tests/unit/proxy/db/test_pgbouncer.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_pgbouncer.py
rename to tests/unit/proxy/db/test_pgbouncer.py
diff --git a/tests/test_litellm/proxy/db/test_prisma_client.py b/tests/unit/proxy/db/test_prisma_client.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_prisma_client.py
rename to tests/unit/proxy/db/test_prisma_client.py
diff --git a/tests/test_litellm/proxy/db/test_prisma_planned_engine_restart.py b/tests/unit/proxy/db/test_prisma_planned_engine_restart.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_prisma_planned_engine_restart.py
rename to tests/unit/proxy/db/test_prisma_planned_engine_restart.py
diff --git a/tests/test_litellm/proxy/db/test_prisma_self_heal.py b/tests/unit/proxy/db/test_prisma_self_heal.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_prisma_self_heal.py
rename to tests/unit/proxy/db/test_prisma_self_heal.py
diff --git a/tests/test_litellm/proxy/db/test_proxy_worker_heartbeat.py b/tests/unit/proxy/db/test_proxy_worker_heartbeat.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_proxy_worker_heartbeat.py
rename to tests/unit/proxy/db/test_proxy_worker_heartbeat.py
diff --git a/tests/test_litellm/proxy/db/test_query_engine_reaper.py b/tests/unit/proxy/db/test_query_engine_reaper.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_query_engine_reaper.py
rename to tests/unit/proxy/db/test_query_engine_reaper.py
diff --git a/tests/test_litellm/proxy/db/test_rds_iam_token_expiry.py b/tests/unit/proxy/db/test_rds_iam_token_expiry.py
similarity index 99%
rename from tests/test_litellm/proxy/db/test_rds_iam_token_expiry.py
rename to tests/unit/proxy/db/test_rds_iam_token_expiry.py
index ca24f856022..5e2356dedea 100644
--- a/tests/test_litellm/proxy/db/test_rds_iam_token_expiry.py
+++ b/tests/unit/proxy/db/test_rds_iam_token_expiry.py
@@ -10,7 +10,7 @@ The fix implements:
4. Fixed __getattr__ fallback that now waits for reconnection
Run these tests:
- uv run pytest tests/test_litellm/proxy/db/test_rds_iam_token_expiry.py -v -s
+ uv run pytest tests/unit/proxy/db/test_rds_iam_token_expiry.py -v -s
"""
import asyncio
diff --git a/tests/test_litellm/proxy/db/test_replica_identity.py b/tests/unit/proxy/db/test_replica_identity.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_replica_identity.py
rename to tests/unit/proxy/db/test_replica_identity.py
diff --git a/tests/test_litellm/proxy/db/test_routing_prisma_wrapper.py b/tests/unit/proxy/db/test_routing_prisma_wrapper.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_routing_prisma_wrapper.py
rename to tests/unit/proxy/db/test_routing_prisma_wrapper.py
diff --git a/tests/test_litellm/proxy/db/test_shadow_eval_funnel.py b/tests/unit/proxy/db/test_shadow_eval_funnel.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_shadow_eval_funnel.py
rename to tests/unit/proxy/db/test_shadow_eval_funnel.py
diff --git a/tests/test_litellm/proxy/db/test_spend_counter_reseed.py b/tests/unit/proxy/db/test_spend_counter_reseed.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_spend_counter_reseed.py
rename to tests/unit/proxy/db/test_spend_counter_reseed.py
diff --git a/tests/test_litellm/proxy/db/test_spend_log_batching.py b/tests/unit/proxy/db/test_spend_log_batching.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_spend_log_batching.py
rename to tests/unit/proxy/db/test_spend_log_batching.py
diff --git a/tests/test_litellm/proxy/db/test_spend_log_tool_index.py b/tests/unit/proxy/db/test_spend_log_tool_index.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_spend_log_tool_index.py
rename to tests/unit/proxy/db/test_spend_log_tool_index.py
diff --git a/tests/test_litellm/proxy/db/test_token_auth.py b/tests/unit/proxy/db/test_token_auth.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_token_auth.py
rename to tests/unit/proxy/db/test_token_auth.py
diff --git a/tests/test_litellm/proxy/db/test_tool_registry_writer.py b/tests/unit/proxy/db/test_tool_registry_writer.py
similarity index 100%
rename from tests/test_litellm/proxy/db/test_tool_registry_writer.py
rename to tests/unit/proxy/db/test_tool_registry_writer.py
diff --git a/tests/test_litellm/proxy/proxy_server/.coverage_baseline b/tests/unit/proxy/proxy_server/.coverage_baseline
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/.coverage_baseline
rename to tests/unit/proxy/proxy_server/.coverage_baseline
diff --git a/tests/unit/proxy/proxy_server/__init__.py b/tests/unit/proxy/proxy_server/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/tests/test_litellm/proxy/proxy_server/_coverage_check.py b/tests/unit/proxy/proxy_server/_coverage_check.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/_coverage_check.py
rename to tests/unit/proxy/proxy_server/_coverage_check.py
diff --git a/tests/test_litellm/proxy/proxy_server/_pin_check.py b/tests/unit/proxy/proxy_server/_pin_check.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/_pin_check.py
rename to tests/unit/proxy/proxy_server/_pin_check.py
diff --git a/tests/test_litellm/proxy/proxy_server/conftest.py b/tests/unit/proxy/proxy_server/conftest.py
similarity index 99%
rename from tests/test_litellm/proxy/proxy_server/conftest.py
rename to tests/unit/proxy/proxy_server/conftest.py
index ae1b42363ef..0d7ec4812ce 100644
--- a/tests/test_litellm/proxy/proxy_server/conftest.py
+++ b/tests/unit/proxy/proxy_server/conftest.py
@@ -1,4 +1,4 @@
-"""Shared fixtures for tests/test_litellm/proxy/proxy_server/.
+"""Shared fixtures for tests/unit/proxy/proxy_server/.
All fixtures and helpers used by PR1/PR2/PR3 test files live here. Do NOT
add fixtures inside individual test files. If a fixture is missing, add it
diff --git a/tests/test_litellm/proxy/proxy_server/test_background_health.py b/tests/unit/proxy/proxy_server/test_background_health.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_background_health.py
rename to tests/unit/proxy/proxy_server/test_background_health.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_exception_handlers.py b/tests/unit/proxy/proxy_server/test_exception_handlers.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_exception_handlers.py
rename to tests/unit/proxy/proxy_server/test_exception_handlers.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_harness_smoke.py b/tests/unit/proxy/proxy_server/test_harness_smoke.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_harness_smoke.py
rename to tests/unit/proxy/proxy_server/test_harness_smoke.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_lifecycle.py b/tests/unit/proxy/proxy_server/test_lifecycle.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_lifecycle.py
rename to tests/unit/proxy/proxy_server/test_lifecycle.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_openapi_customization.py b/tests/unit/proxy/proxy_server/test_openapi_customization.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_openapi_customization.py
rename to tests/unit/proxy/proxy_server/test_openapi_customization.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_proxy_config.py b/tests/unit/proxy/proxy_server/test_proxy_config.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_proxy_config.py
rename to tests/unit/proxy/proxy_server/test_proxy_config.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_anthropic_beta.py b/tests/unit/proxy/proxy_server/test_routes_anthropic_beta.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_anthropic_beta.py
rename to tests/unit/proxy/proxy_server/test_routes_anthropic_beta.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_assistants.py b/tests/unit/proxy/proxy_server/test_routes_assistants.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_assistants.py
rename to tests/unit/proxy/proxy_server/test_routes_assistants.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_audio.py b/tests/unit/proxy/proxy_server/test_routes_audio.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_audio.py
rename to tests/unit/proxy/proxy_server/test_routes_audio.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_chat_completions.py b/tests/unit/proxy/proxy_server/test_routes_chat_completions.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_chat_completions.py
rename to tests/unit/proxy/proxy_server/test_routes_chat_completions.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_completions.py b/tests/unit/proxy/proxy_server/test_routes_completions.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_completions.py
rename to tests/unit/proxy/proxy_server/test_routes_completions.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_config.py b/tests/unit/proxy/proxy_server/test_routes_config.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_config.py
rename to tests/unit/proxy/proxy_server/test_routes_config.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_embeddings.py b/tests/unit/proxy/proxy_server/test_routes_embeddings.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_embeddings.py
rename to tests/unit/proxy/proxy_server/test_routes_embeddings.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_invitation.py b/tests/unit/proxy/proxy_server/test_routes_invitation.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_invitation.py
rename to tests/unit/proxy/proxy_server/test_routes_invitation.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_login_sso.py b/tests/unit/proxy/proxy_server/test_routes_login_sso.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_login_sso.py
rename to tests/unit/proxy/proxy_server/test_routes_login_sso.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_misc.py b/tests/unit/proxy/proxy_server/test_routes_misc.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_misc.py
rename to tests/unit/proxy/proxy_server/test_routes_misc.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_model_cost_map.py b/tests/unit/proxy/proxy_server/test_routes_model_cost_map.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_model_cost_map.py
rename to tests/unit/proxy/proxy_server/test_routes_model_cost_map.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_model_info.py b/tests/unit/proxy/proxy_server/test_routes_model_info.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_model_info.py
rename to tests/unit/proxy/proxy_server/test_routes_model_info.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_model_metrics.py b/tests/unit/proxy/proxy_server/test_routes_model_metrics.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_model_metrics.py
rename to tests/unit/proxy/proxy_server/test_routes_model_metrics.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_models.py b/tests/unit/proxy/proxy_server/test_routes_models.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_models.py
rename to tests/unit/proxy/proxy_server/test_routes_models.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_moderations.py b/tests/unit/proxy/proxy_server/test_routes_moderations.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_moderations.py
rename to tests/unit/proxy/proxy_server/test_routes_moderations.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_onboarding.py b/tests/unit/proxy/proxy_server/test_routes_onboarding.py
similarity index 95%
rename from tests/test_litellm/proxy/proxy_server/test_routes_onboarding.py
rename to tests/unit/proxy/proxy_server/test_routes_onboarding.py
index 6c1d869d113..f96e2d1e367 100644
--- a/tests/test_litellm/proxy/proxy_server/test_routes_onboarding.py
+++ b/tests/unit/proxy/proxy_server/test_routes_onboarding.py
@@ -8,11 +8,14 @@ Routes covered:
from __future__ import annotations
from datetime import datetime, timedelta, timezone
+import hashlib
from types import SimpleNamespace
from unittest.mock import AsyncMock, MagicMock
+import httpx
import jwt
import pytest
+import respx
from .conftest import normalize
@@ -202,7 +205,17 @@ def _make_onboarding_jwt(
)
-def test_claim_onboarding_link_happy(client, monkeypatch, mock_prisma):
+def _hibp_url_for(password: str) -> str:
+ sha1 = hashlib.sha1(password.encode("utf-8"), usedforsecurity=False).hexdigest().upper()
+ return f"https://api.pwnedpasswords.com/range/{sha1[:5]}"
+
+
+def _hibp_suffix_for(password: str) -> str:
+ return hashlib.sha1(password.encode("utf-8"), usedforsecurity=False).hexdigest().upper()[5:]
+
+
+def test_claim_onboarding_link_happy(client, monkeypatch, mock_prisma, httpx_transport):
"""Valid claim → returns login_url, token, user_email, user."""
from litellm.proxy import proxy_server as ps
@@ -228,13 +241,18 @@ def test_claim_onboarding_link_happy(client, monkeypatch, mock_prisma):
ps, "_generate_onboarding_ui_session_token", _fake_session_token
)
+ password = "Hunter2Strong!"
+ respx.get(_hibp_url_for(password)).mock(
+ return_value=httpx.Response(200, text=f"{_hibp_suffix_for('unrelated-password')}:9")
+ )
+
onboarding_jwt = _make_onboarding_jwt("sk-master-test")
response = client.post(
"/onboarding/claim_token",
json={
"invitation_link": "inv-123",
"user_id": "user-abc",
- "password": "Hunter2Strong!",
+ "password": password,
},
headers={"Authorization": f"Bearer {onboarding_jwt}"},
)
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_queue.py b/tests/unit/proxy/proxy_server/test_routes_queue.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_queue.py
rename to tests/unit/proxy/proxy_server/test_routes_queue.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_threads.py b/tests/unit/proxy/proxy_server/test_routes_threads.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_routes_threads.py
rename to tests/unit/proxy/proxy_server/test_routes_threads.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_routes_utils.py b/tests/unit/proxy/proxy_server/test_routes_utils.py
similarity index 98%
rename from tests/test_litellm/proxy/proxy_server/test_routes_utils.py
rename to tests/unit/proxy/proxy_server/test_routes_utils.py
index 6cd613197ee..91329d122ee 100644
--- a/tests/test_litellm/proxy/proxy_server/test_routes_utils.py
+++ b/tests/unit/proxy/proxy_server/test_routes_utils.py
@@ -12,7 +12,9 @@ from __future__ import annotations
import asyncio
import json
+import httpx
import pytest
+import respx
import litellm
from litellm.litellm_core_utils import get_llm_provider_logic
@@ -282,10 +284,16 @@ def test_model_info_lookup_unknown_model_returns_404(client, auth_as, monkeypatc
assert "is not in the model cost map" in response.text
-def test_model_info_lookup_returns_404_when_typed_info_has_no_cost_map_entry(client, auth_as, monkeypatch):
+def test_model_info_lookup_returns_404_when_typed_info_has_no_cost_map_entry(
+ client, auth_as, monkeypatch, local_model_cost_map
+):
"""``get_model_info`` synthesizes info for huggingface fallbacks absent from ``model_cost``;
with no raw entry the route must 404 rather than answer 200 with typed fields only."""
monkeypatch.setattr(proxy_server, "llm_router", None)
+ respx.get("https://huggingface.co/not-in-map-org/not-in-map-model/raw/main/config.json").mock(
+ return_value=httpx.Response(404)
+ )
with auth_as():
response = client.get("/utils/model_info", params={"model": "huggingface/not-in-map-org/not-in-map-model"})
assert response.status_code == 404, response.text
diff --git a/tests/test_litellm/proxy/proxy_server/test_spend_counters.py b/tests/unit/proxy/proxy_server/test_spend_counters.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_spend_counters.py
rename to tests/unit/proxy/proxy_server/test_spend_counters.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_streaming_helpers.py b/tests/unit/proxy/proxy_server/test_streaming_helpers.py
similarity index 100%
rename from tests/test_litellm/proxy/proxy_server/test_streaming_helpers.py
rename to tests/unit/proxy/proxy_server/test_streaming_helpers.py
diff --git a/tests/test_litellm/proxy/proxy_server/test_team_model_name_translation.py b/tests/unit/proxy/proxy_server/test_team_model_name_translation.py
similarity index 99%
rename from tests/test_litellm/proxy/proxy_server/test_team_model_name_translation.py
rename to tests/unit/proxy/proxy_server/test_team_model_name_translation.py
index baa032f75e6..b848c4f1976 100644
--- a/tests/test_litellm/proxy/proxy_server/test_team_model_name_translation.py
+++ b/tests/unit/proxy/proxy_server/test_team_model_name_translation.py
@@ -1,6 +1,6 @@
"""Coverage for team-scoped model-name translation in /model/info responses.
-These live in tests/test_litellm/proxy/proxy_server/ (not the top-level
+These live in tests/unit/proxy/proxy_server/ (not the top-level
test_proxy_server.py) because the CI coverage job collects this directory.
They exercise the read-path fix for issue #28382: `/v1`, `/v2`, and
`/model/info` must surface `model_info.team_public_model_name` for team-scoped