Skip to content

Commit 135f28b

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 813e69d commit 135f28b

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

tests/test_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -959,8 +959,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
959959
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
960960
# Test that the proxy environment variables are set correctly
961961
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
962-
# Delete in case our environment has this set
962+
# Delete in case our environment has any proxy env vars set
963963
monkeypatch.delenv("HTTP_PROXY", raising=False)
964+
monkeypatch.delenv("ALL_PROXY", raising=False)
965+
monkeypatch.delenv("NO_PROXY", raising=False)
966+
monkeypatch.delenv("http_proxy", raising=False)
967+
monkeypatch.delenv("https_proxy", raising=False)
968+
monkeypatch.delenv("all_proxy", raising=False)
969+
monkeypatch.delenv("no_proxy", raising=False)
964970

965971
client = DefaultHttpxClient()
966972

@@ -1873,8 +1879,14 @@ async def test_get_platform(self) -> None:
18731879
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18741880
# Test that the proxy environment variables are set correctly
18751881
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1876-
# Delete in case our environment has this set
1882+
# Delete in case our environment has any proxy env vars set
18771883
monkeypatch.delenv("HTTP_PROXY", raising=False)
1884+
monkeypatch.delenv("ALL_PROXY", raising=False)
1885+
monkeypatch.delenv("NO_PROXY", raising=False)
1886+
monkeypatch.delenv("http_proxy", raising=False)
1887+
monkeypatch.delenv("https_proxy", raising=False)
1888+
monkeypatch.delenv("all_proxy", raising=False)
1889+
monkeypatch.delenv("no_proxy", raising=False)
18781890

18791891
client = DefaultAsyncHttpxClient()
18801892

0 commit comments

Comments
 (0)