Skip to content

Commit 976c1fb

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 72aa790 commit 976c1fb

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
@@ -961,8 +961,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
961961
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
962962
# Test that the proxy environment variables are set correctly
963963
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
964-
# Delete in case our environment has this set
964+
# Delete in case our environment has any proxy env vars set
965965
monkeypatch.delenv("HTTP_PROXY", raising=False)
966+
monkeypatch.delenv("ALL_PROXY", raising=False)
967+
monkeypatch.delenv("NO_PROXY", raising=False)
968+
monkeypatch.delenv("http_proxy", raising=False)
969+
monkeypatch.delenv("https_proxy", raising=False)
970+
monkeypatch.delenv("all_proxy", raising=False)
971+
monkeypatch.delenv("no_proxy", raising=False)
966972

967973
client = DefaultHttpxClient()
968974

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

18811893
client = DefaultAsyncHttpxClient()
18821894

0 commit comments

Comments
 (0)