test(bedrock): justify the litellm-internal patch for CI's test-quality gate

The test-quality budget (TQ008) flags any patch() targeting a litellm.
internal, since that idiom usually pins wiring instead of behavior.
Here the point of the test is exactly which invoke_provider the decoder
factory receives, so the patch is unavoidable; annotate it.
This commit is contained in:
rsd-darshan 2026-08-27 11:56:37 +05:45
parent 6abbb79935
commit 1227ab8366
No known key found for this signature in database
GPG key ID: 5317D533B1678165

View file

@ -523,7 +523,9 @@ def test_handle_logging_collected_chunks_inference_profile_arn_falls_back_gracef
# Intercept the decoder so we don't need real botocore event-stream bytes.
# The import is done inside handle_logging_collected_chunks, so patch the source module.
with patch("litellm.llms.bedrock.chat.get_bedrock_event_stream_decoder") as mock_decoder:
with patch( # test-quality-ok: the behavior under test is which invoke_provider this factory receives
"litellm.llms.bedrock.chat.get_bedrock_event_stream_decoder"
) as mock_decoder:
mock_chunk_obj = MagicMock()
mock_chunk_obj._chunk_parser.return_value = {} # not a valid GenericStreamingChunk
mock_decoder.return_value = mock_chunk_obj