mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-05 02:41:56 +00:00
test(a2a): record why the routing test patches SDK internals (TQ008)
The test-quality gate flags `patch()` on `litellm.` internals, preferring a faked HTTP boundary or an injected collaborator. Neither applies here: the regression is that the request never leaves the router, so which collaborator is called is precisely the assertion, and the agent registry is Prisma-backed with no unit-test injection seam. Both patches now carry a reason, matching the pattern the sibling tests in this file already use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f757c52570
commit
a1dbd1f28c
1 changed files with 14 additions and 10 deletions
|
|
@ -249,16 +249,20 @@ async def test_a2a_model_resolves_before_router_branches(router_kwargs, extra_da
|
|||
|
||||
mock_acompletion = AsyncMock(return_value={"id": "test-response"})
|
||||
|
||||
with patch("litellm.acompletion", mock_acompletion), patch(
|
||||
"litellm.proxy.agent_endpoints.agent_registry.global_agent_registry",
|
||||
mock_registry,
|
||||
):
|
||||
await route_request(
|
||||
data=data,
|
||||
llm_router=_router_without_a2a_deployment(**router_kwargs),
|
||||
user_model=None,
|
||||
route_type="acompletion",
|
||||
)
|
||||
# The bug is that the request never leaves the router, so there is no HTTP boundary to
|
||||
# fake: which collaborator gets called *is* the behaviour under test. The registry is
|
||||
# Prisma-backed and has no injection seam available to a unit test.
|
||||
with patch("litellm.acompletion", mock_acompletion): # test-quality-ok: the dispatch target is the assertion
|
||||
with patch( # test-quality-ok: Prisma-backed registry has no unit-test injection seam
|
||||
"litellm.proxy.agent_endpoints.agent_registry.global_agent_registry",
|
||||
mock_registry,
|
||||
):
|
||||
await route_request(
|
||||
data=data,
|
||||
llm_router=_router_without_a2a_deployment(**router_kwargs),
|
||||
user_model=None,
|
||||
route_type="acompletion",
|
||||
)
|
||||
|
||||
mock_acompletion.assert_called_once()
|
||||
call_kwargs = mock_acompletion.call_args.kwargs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue