From 3522e1d0c8d89bed7c69daddb12e339ab7f5922b Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 7 Apr 2026 13:48:24 -0700 Subject: [PATCH] fix(tests): update proxy env var test assertions for httpx 0.28 httpx 0.28 includes default fallback mounts (None transports) in _mounts, so filtering for non-None transports and checking the proxy pattern exists is more robust than asserting exact mount count. --- tests/test_client.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_client.py b/tests/test_client.py index 057c4a4..33ac17f 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -892,9 +892,10 @@ def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> N client = DefaultHttpxClient() - mounts = tuple(client._mounts.items()) - assert len(mounts) == 1 - assert mounts[0][0].pattern == "https://" + proxy_mounts = { + pattern.pattern: transport for pattern, transport in client._mounts.items() if transport is not None + } + assert "https://" in proxy_mounts @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") def test_default_client_creation(self) -> None: @@ -1778,9 +1779,10 @@ async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch client = DefaultAsyncHttpxClient() - mounts = tuple(client._mounts.items()) - assert len(mounts) == 1 - assert mounts[0][0].pattern == "https://" + proxy_mounts = { + pattern.pattern: transport for pattern, transport in client._mounts.items() if transport is not None + } + assert "https://" in proxy_mounts @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") async def test_default_client_creation(self) -> None: