Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test(bedrock_mantle): capture the drop warning with caplog instead of patching the logger

mateo-berri8713ba8a5250
diff --git a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py
index 4e6c69ea482..e8496eca4e5 100644
--- a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py
+++ b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py
@@ -400,17 +400,26 @@ class TestBedrockMantleResponsesWebSearch:
)
assert body["tools"] == [self._WEB_SEARCH_TOOL, function_tool]
- def test_web_search_is_not_logged_as_dropped(self):
- from unittest.mock import patch
-
+ def test_web_search_is_not_logged_as_dropped(self, caplog):
cfg = BedrockMantleResponsesAPIConfig()
- with patch("litellm.llms.bedrock_mantle.responses.transformation.verbose_logger.warning") as mock_warning:
+
+ def drop_warnings() -> list[str]:
+ return [r.getMessage() for r in caplog.records if "dropping unsupported tool type" in r.getMessage()]
+
+ with caplog.at_level(logging.WARNING, logger="LiteLLM"):
+ cfg.map_openai_params(
+ response_api_optional_params={"tools": [{"type": "file_search"}]},
+ model="openai.gpt-5.6-sol",
+ drop_params=False,
+ )
+ assert len(drop_warnings()) == 1
+ caplog.clear()
cfg.map_openai_params(
response_api_optional_params={"tools": [self._WEB_SEARCH_TOOL]},
model="openai.gpt-5.6-sol",
drop_params=False,
)
- assert mock_warning.call_count == 0
+ assert drop_warnings() == []
def test_hoisted_web_search_tool_survives(self):
cfg = BedrockMantleResponsesAPIConfig()