mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
test: suppress TQ008 on the rerank header tests with reasons
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
0d9ee6d9ee
commit
decc7f20cc
2 changed files with 13 additions and 13 deletions
|
|
@ -77,7 +77,7 @@ def test_bedrock_rerank_header_forwarding_sync(model):
|
|||
|
||||
with (
|
||||
patch.object(client, "post") as mock_post,
|
||||
patch(
|
||||
patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=mock_credentials_info,
|
||||
),
|
||||
|
|
@ -170,7 +170,7 @@ async def test_bedrock_rerank_header_forwarding_async(model):
|
|||
|
||||
with (
|
||||
patch.object(client, "post", new_callable=AsyncMock) as mock_post,
|
||||
patch(
|
||||
patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=mock_credentials_info,
|
||||
),
|
||||
|
|
@ -241,7 +241,7 @@ def test_bedrock_rerank_timeout_sync():
|
|||
|
||||
with (
|
||||
patch.object(client, "post") as mock_post,
|
||||
patch(
|
||||
patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=mock_credentials_info,
|
||||
),
|
||||
|
|
@ -285,7 +285,7 @@ async def test_bedrock_rerank_timeout_async():
|
|||
|
||||
with (
|
||||
patch.object(client, "post", new_callable=AsyncMock) as mock_post,
|
||||
patch(
|
||||
patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=mock_credentials_info,
|
||||
),
|
||||
|
|
@ -340,7 +340,7 @@ def test_bedrock_rerank_extra_headers_and_headers_merge():
|
|||
|
||||
with (
|
||||
patch.object(client, "post") as mock_post,
|
||||
patch(
|
||||
patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=mock_credentials_info,
|
||||
),
|
||||
|
|
@ -414,7 +414,7 @@ async def test_bedrock_rerank_records_llm_api_duration():
|
|||
client = AsyncHTTPHandler()
|
||||
client.client = httpx.AsyncClient(transport=httpx.MockTransport(handle))
|
||||
|
||||
with patch(
|
||||
with patch( # test-quality-ok: boto credential lookup needs live AWS; the HTTP boundary is already a MockTransport
|
||||
"litellm.llms.bedrock.rerank.handler.BedrockRerankHandler._get_boto_credentials_from_optional_params",
|
||||
return_value=create_mock_credentials(),
|
||||
):
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ async def _call_rerank(hidden_params: dict = HIDDEN_PARAMS) -> Response:
|
|||
return _call()
|
||||
|
||||
with (
|
||||
patch.object(proxy_server_mod, "add_litellm_data_to_request", fake_add_litellm_data_to_request),
|
||||
patch.object(proxy_server_mod, "route_request", fake_route_request),
|
||||
patch.object(proxy_server_mod, "proxy_logging_obj", proxy_logging_obj),
|
||||
patch.object(proxy_server_mod, "llm_router", MagicMock()),
|
||||
patch.object(proxy_server_mod, "version", "1.2.3"),
|
||||
patch.object(proxy_server_mod, "add_litellm_data_to_request", fake_add_litellm_data_to_request), # test-quality-ok: the rerank route reads these proxy_server module globals; no injection seam on the FastAPI handler
|
||||
patch.object(proxy_server_mod, "route_request", fake_route_request), # test-quality-ok: the rerank route reads these proxy_server module globals; no injection seam on the FastAPI handler
|
||||
patch.object(proxy_server_mod, "proxy_logging_obj", proxy_logging_obj), # test-quality-ok: the rerank route reads these proxy_server module globals; no injection seam on the FastAPI handler
|
||||
patch.object(proxy_server_mod, "llm_router", MagicMock()), # test-quality-ok: the rerank route reads these proxy_server module globals; no injection seam on the FastAPI handler
|
||||
patch.object(proxy_server_mod, "version", "1.2.3"), # test-quality-ok: the rerank route reads these proxy_server module globals; no injection seam on the FastAPI handler
|
||||
):
|
||||
await rerank(
|
||||
request=_build_request(),
|
||||
|
|
@ -95,7 +95,7 @@ async def test_rerank_emits_latency_and_cost_headers():
|
|||
@pytest.mark.asyncio
|
||||
async def test_rerank_emits_detailed_timing_headers_when_enabled():
|
||||
"""LITELLM_DETAILED_TIMING must also work on /rerank, not just /chat/completions."""
|
||||
with patch.object(common_request_processing_mod, "LITELLM_DETAILED_TIMING", True):
|
||||
with patch.object(common_request_processing_mod, "LITELLM_DETAILED_TIMING", True): # test-quality-ok: LITELLM_DETAILED_TIMING is a module constant; toggling it is the behavior under test
|
||||
fastapi_response = await _call_rerank()
|
||||
|
||||
assert fastapi_response.headers["x-litellm-timing-llm-api-ms"] == "1488.0"
|
||||
|
|
@ -114,7 +114,7 @@ async def test_rerank_emits_zero_response_cost_header():
|
|||
|
||||
@pytest.mark.asyncio
|
||||
async def test_rerank_omits_detailed_timing_headers_when_disabled():
|
||||
with patch.object(common_request_processing_mod, "LITELLM_DETAILED_TIMING", False):
|
||||
with patch.object(common_request_processing_mod, "LITELLM_DETAILED_TIMING", False): # test-quality-ok: LITELLM_DETAILED_TIMING is a module constant; toggling it is the behavior under test
|
||||
fastapi_response = await _call_rerank()
|
||||
|
||||
assert "x-litellm-timing-llm-api-ms" not in fastapi_response.headers
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue