The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test: trim mcp fixture docstring and reload comment
Devin AI5f44bdd1c123
diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py b/tests/test_litellm/proxy/_experimental/mcp_server/conftest.pyindex c559e023c47..2ccba2b2055 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/conftest.py@@ -9,15 +9,8 @@ from litellm.proxy._experimental.mcp_server.mcp_server_manager import (@pytest.fixture(autouse=True)def _hermetic_mcp_server_registry():- """Snapshot and restore the global manager's server-registry state around every test.-- ``global_mcp_server_manager`` is a module-global singleton, and many tests in this- package seed ``registry``/``config_mcp_servers`` (or clear them) without cleaning up.- In a shared CI shard the leaked entries poison later tests in the same worker, e.g.- the ``all_proxy_servers`` sentinel expansion in ``auth/`` suddenly sees a bridge- server registered by a discovery test, so the outcome depends on xdist scheduling.- Restoring the state here makes ordering irrelevant.- """+ """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."""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)diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.pyindex 934810c305f..1c65adac4c6 100644--- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py+++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_identity_env.py@@ -25,11 +25,9 @@ def _env_and_reload(**env):saved = {key: os.environ.get(key) for key in env}utils_module = importlib.import_module(UTILS_MODULE)mgmt_module = importlib.import_module(MGMT_MODULE)- # Restore the pre-reload module attributes afterwards instead of reloading- # a third time: a reload re-creates every class in the module, so modules- # that imported names like MCPMissingUserEnvVarsError before this test- # would keep raising the old class while pytest.raises in later tests- # matches the new one+ # Restore pre-reload module attributes afterwards instead of reloading again:+ # a reload re-creates the module's classes, breaking exception identity for+ # modules that imported them earliersnapshots = {module: dict(vars(module)) for module in (utils_module, mgmt_module)}def _apply_env(values):