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]

fix(tests): mock httpx in RPM limit pass-through tests (#21793)

Ishaan Jaffa0e76f4f2564
diff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.py
index 3ca504fc6e7..44368be77a1 100644
--- a/tests/local_testing/test_pass_through_endpoints.py
+++ b/tests/local_testing/test_pass_through_endpoints.py
@@ -173,8 +173,9 @@ async def test_pass_through_endpoint_rerank(client):
)
@pytest.mark.asyncio
async def test_pass_through_endpoint_rpm_limit(
- client, auth, rpm_limit, requests_to_make, expected_status_codes, num_users
+ client, monkeypatch, auth, rpm_limit, requests_to_make, expected_status_codes, num_users
):
+ monkeypatch.setattr("httpx.AsyncClient.request", mock_request)
import litellm
from litellm.proxy._types import UserAPIKeyAuth
from litellm.proxy.proxy_server import ProxyLogging, hash_token, user_api_key_cache
@@ -273,8 +274,9 @@ async def test_pass_through_endpoint_rpm_limit(
)
@pytest.mark.asyncio
async def test_pass_through_endpoint_sequential_rpm_limit(
- client, auth, rpm_limit, requests_to_make, expected_status_codes
+ client, monkeypatch, auth, rpm_limit, requests_to_make, expected_status_codes
):
+ monkeypatch.setattr("httpx.AsyncClient.request", mock_request)
import litellm
from litellm.proxy._types import UserAPIKeyAuth
from litellm.proxy.proxy_server import ProxyLogging, hash_token, user_api_key_cache