mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
Merge pull request #40347 from BerriAI/litellm_fix_mcp_proxy_test_isolation
test(mcp): fix proxy fixture isolation after manager reload
This commit is contained in:
commit
1fbd1cb9ce
2 changed files with 6 additions and 5 deletions
|
|
@ -2,15 +2,15 @@ import os
|
|||
|
||||
import pytest
|
||||
|
||||
from litellm.proxy._experimental.mcp_server.mcp_server_manager import (
|
||||
global_mcp_server_manager,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(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)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ from mcp.types import CallToolResult, TextContent, Tool
|
|||
|
||||
from litellm.proxy._experimental.mcp_server import server
|
||||
from litellm.proxy._experimental.mcp_server.faults.list_outcomes import AggregateToolListing
|
||||
from litellm.proxy._experimental.mcp_server.mcp_server_manager import global_mcp_server_manager
|
||||
from litellm.proxy._experimental.mcp_server.tool_search import (
|
||||
MCP_PROXY_CALL_TOOL_NAME,
|
||||
MCP_PROXY_SCHEMA_TOOL_NAME,
|
||||
|
|
@ -271,6 +270,8 @@ class TestMcpProxyAuthorizationScope:
|
|||
|
||||
@pytest.fixture
|
||||
def rig(self) -> Iterator[AsyncMock]:
|
||||
from litellm.proxy._experimental.mcp_server.mcp_server_manager import global_mcp_server_manager
|
||||
|
||||
upstream = {
|
||||
"srv-alpha": [_upstream_tool("alpha", "add"), _upstream_tool("alpha", "multiply")],
|
||||
"srv-beta": [_upstream_tool("beta", "add")],
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue