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(rag): wrap the store-forwarding patches so every new line fits in 120 chars

mateo-berri91061675ae48
diff --git a/tests/test_litellm/proxy/rag_endpoints/test_rag_endpoints.py b/tests/test_litellm/proxy/rag_endpoints/test_rag_endpoints.py
index e68a964e997..a176e91eaa4 100644
--- a/tests/test_litellm/proxy/rag_endpoints/test_rag_endpoints.py
+++ b/tests/test_litellm/proxy/rag_endpoints/test_rag_endpoints.py
@@ -460,13 +460,14 @@ def test_rag_query_forwards_managed_store_credentials_to_search(client_internal_
]
)
- with patch( # test-quality-ok: asearch is the boundary the store-credential forwarding under test targets; the real aquery pipeline runs in between
- "litellm.vector_stores.asearch", new=fake_search
- ), patch.object(litellm, "vector_store_registry", mock_registry), patch( # test-quality-ok: seeds the managed-store registry and a mock-response router so real store resolution and the completion step run
- "litellm.proxy.proxy_server.llm_router", router
- ), patch( # test-quality-ok: grants store access, which is not under test, so the endpoint reaches the search boundary
- "litellm.proxy.vector_store_endpoints.utils.can_user_access_vector_store",
- new=AsyncMock(return_value=True),
+ with (
+ patch("litellm.vector_stores.asearch", new=fake_search), # test-quality-ok: the search boundary under test
+ patch.object(litellm, "vector_store_registry", mock_registry), # test-quality-ok: seeds the store under test
+ patch("litellm.proxy.proxy_server.llm_router", router), # test-quality-ok: mock-response router for completion
+ patch( # test-quality-ok: store access is not under test, so the request reaches the search boundary
+ "litellm.proxy.vector_store_endpoints.utils.can_user_access_vector_store",
+ new=AsyncMock(return_value=True),
+ ),
):
response = client_internal_user.post(
"/v1/rag/query",
diff --git a/tests/test_litellm/rag/test_main.py b/tests/test_litellm/rag/test_main.py
index 420b72b6a3d..f119088b0e9 100644
--- a/tests/test_litellm/rag/test_main.py
+++ b/tests/test_litellm/rag/test_main.py
@@ -413,8 +413,9 @@ async def test_aquery_forwards_vector_store_params_to_search_but_not_completion(
model="gpt-4o-mini",
)
)
- with patch("litellm.vector_stores.asearch", new=fake_search), patch( # test-quality-ok: asearch and acompletion are the two boundaries the forwarding contract under test targets
- "litellm.acompletion", new=fake_completion
+ with (
+ patch("litellm.vector_stores.asearch", new=fake_search), # test-quality-ok: the search boundary under test
+ patch("litellm.acompletion", new=fake_completion), # test-quality-ok: the completion boundary under test
):
await litellm.aquery(
model="gpt-4o-mini",