Skip to content

Commit 8b312f4

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent bfcb31e commit 8b312f4

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/test_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -904,8 +904,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
904904
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
905905
# Test that the proxy environment variables are set correctly
906906
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
907-
# Delete in case our environment has this set
907+
# Delete in case our environment has any proxy env vars set
908908
monkeypatch.delenv("HTTP_PROXY", raising=False)
909+
monkeypatch.delenv("ALL_PROXY", raising=False)
910+
monkeypatch.delenv("NO_PROXY", raising=False)
911+
monkeypatch.delenv("http_proxy", raising=False)
912+
monkeypatch.delenv("https_proxy", raising=False)
913+
monkeypatch.delenv("all_proxy", raising=False)
914+
monkeypatch.delenv("no_proxy", raising=False)
909915

910916
client = DefaultHttpxClient()
911917

@@ -1758,8 +1764,14 @@ async def test_get_platform(self) -> None:
17581764
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
17591765
# Test that the proxy environment variables are set correctly
17601766
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1761-
# Delete in case our environment has this set
1767+
# Delete in case our environment has any proxy env vars set
17621768
monkeypatch.delenv("HTTP_PROXY", raising=False)
1769+
monkeypatch.delenv("ALL_PROXY", raising=False)
1770+
monkeypatch.delenv("NO_PROXY", raising=False)
1771+
monkeypatch.delenv("http_proxy", raising=False)
1772+
monkeypatch.delenv("https_proxy", raising=False)
1773+
monkeypatch.delenv("all_proxy", raising=False)
1774+
monkeypatch.delenv("no_proxy", raising=False)
17631775

17641776
client = DefaultAsyncHttpxClient()
17651777

0 commit comments

Comments
 (0)