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(aiohttp): pin NO_PROXY so proxy env cannot hijack the refused-port probe

mateo-berri02f6b5b5ec4b
diff --git a/tests/litellm_utils_tests/test_aiohttp_handler.py b/tests/litellm_utils_tests/test_aiohttp_handler.py
index bd1e34ddb2f..3318cc1aef8 100644
--- a/tests/litellm_utils_tests/test_aiohttp_handler.py
+++ b/tests/litellm_utils_tests/test_aiohttp_handler.py
@@ -49,7 +49,10 @@ async def test_event_loop_robustness() -> None:
@pytest.mark.parametrize(("ssl_verify", "expected_ssl"), [(False, False), (None, True)])
-async def test_refused_connection_maps_to_httpx_connect_error(ssl_verify: bool | None, expected_ssl: bool) -> None:
+async def test_refused_connection_maps_to_httpx_connect_error(
+ ssl_verify: bool | None, expected_ssl: bool, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setenv("NO_PROXY", "127.0.0.1")
transport: Final = AsyncHTTPHandler._create_aiohttp_transport(ssl_verify=ssl_verify)
port: Final = _closed_local_port()
request: Final = httpx.Request("GET", f"https://127.0.0.1:{port}/")