mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
test: trim redundant MCP gateway tests
- Drop test_initial_call_success_does_not_emit_error_event: the tool-call happy path (test_tool_call_happy_path_emits_no_error_event) already guards against false-positive error events and exercises more of the changed code (tool-exec + follow-up success paths). - Drop the stream=True parametrization on the zero-resolved-tools guard: the guard runs before the stream/non-stream branch in aresponses_api_with_mcp, so both cases hit identical code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
d181176fb7
commit
092bc79432
2 changed files with 4 additions and 21 deletions
|
|
@ -40,8 +40,9 @@ def _model_response() -> ResponsesAPIResponse:
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("stream", [False, True])
|
||||
async def test_zero_resolved_mcp_tools_raises_before_model_call(monkeypatch, stream):
|
||||
async def test_zero_resolved_mcp_tools_raises_before_model_call(monkeypatch):
|
||||
# The guard runs before the stream/non-stream branch in
|
||||
# aresponses_api_with_mcp, so one case covers both.
|
||||
_patch_resolved_tools(monkeypatch, [])
|
||||
aresponses_mock = AsyncMock()
|
||||
monkeypatch.setattr(responses_main_module, "aresponses", aresponses_mock)
|
||||
|
|
@ -50,7 +51,7 @@ async def test_zero_resolved_mcp_tools_raises_before_model_call(monkeypatch, str
|
|||
await responses_main_module.aresponses_api_with_mcp(
|
||||
input="how many links do i have?",
|
||||
model="gpt-4",
|
||||
stream=stream,
|
||||
stream=False,
|
||||
tools=[MCP_TOOL],
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -130,24 +130,6 @@ async def test_eager_creation_reraises_pre_stream_failure_as_http_error(monkeypa
|
|||
assert "resp_bogus" in str(excinfo.value)
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_initial_call_success_does_not_emit_error_event(monkeypatch):
|
||||
"""Happy path is unchanged: no error event, stream flows as before."""
|
||||
monkeypatch.setattr(
|
||||
responses_main_module,
|
||||
"aresponses",
|
||||
AsyncMock(return_value=_text_only_stream("all good")),
|
||||
)
|
||||
|
||||
iterator = _make_lazy_iterator()
|
||||
chunks = [chunk async for chunk in iterator]
|
||||
|
||||
assert all(getattr(c, "type", None) != ResponsesAPIStreamEvents.ERROR for c in chunks)
|
||||
completed = [c for c in chunks if getattr(c, "type", None) == ResponsesAPIStreamEvents.RESPONSE_COMPLETED]
|
||||
assert len(completed) == 1
|
||||
assert iterator._initial_creation_error is None
|
||||
|
||||
|
||||
import types
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue