mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
fix: mcp timeout test uses real asyncio.wait_for timeout; you_com get_complete_url respects resolved api_key
This commit is contained in:
parent
8e45e8a98a
commit
de1307b3a3
2 changed files with 14 additions and 3 deletions
|
|
@ -93,7 +93,7 @@ class YouComSearchConfig(BaseSearchConfig):
|
|||
api_base = get_secret_str("YOUCOM_API_BASE")
|
||||
|
||||
if api_base is None:
|
||||
api_key = get_secret_str("YOUCOM_API_KEY")
|
||||
api_key = kwargs.get("api_key") or get_secret_str("YOUCOM_API_KEY")
|
||||
if api_key:
|
||||
api_base = self.YOU_COM_API_BASE
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -3157,8 +3157,19 @@ class TestMCPServerTimestamps:
|
|||
timeout=2.0,
|
||||
)
|
||||
|
||||
async def _slow_call(*args, **kwargs):
|
||||
await asyncio.sleep(999)
|
||||
|
||||
mock_client = AsyncMock()
|
||||
mock_client.call_tool = AsyncMock(side_effect=asyncio.CancelledError())
|
||||
mock_client.call_tool = _slow_call
|
||||
|
||||
server = MCPServer(
|
||||
server_id="timeout-tool-server",
|
||||
name="timeout_tool_server",
|
||||
url="https://example.com/mcp",
|
||||
transport=MCPTransport.http,
|
||||
timeout=0.01,
|
||||
)
|
||||
|
||||
with patch.object(manager, "_create_mcp_client", return_value=mock_client):
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
|
|
@ -3176,7 +3187,7 @@ class TestMCPServerTimestamps:
|
|||
|
||||
assert exc_info.value.status_code == 504
|
||||
assert exc_info.value.detail["error"] == "timeout"
|
||||
assert "2.0s" in exc_info.value.detail["message"]
|
||||
assert "0.01s" in exc_info.value.detail["message"]
|
||||
|
||||
|
||||
class TestInternalDelegatePkceWarningLog:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue