From a1dbd1f28caaf4cfa5c7b0f67fc2ff0d46d6753f Mon Sep 17 00:00:00 2001 From: Peter Boers Date: Thu, 3 Sep 2026 10:52:48 +0200 Subject: [PATCH] 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) --- .../proxy/test_route_a2a_models.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/test_litellm/proxy/test_route_a2a_models.py b/tests/test_litellm/proxy/test_route_a2a_models.py index 8e5954cf5af..6dc69e566d8 100644 --- a/tests/test_litellm/proxy/test_route_a2a_models.py +++ b/tests/test_litellm/proxy/test_route_a2a_models.py @@ -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