Skip to content

Commit 21d4ce8

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 564cd57 commit 21d4ce8

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
@@ -1002,8 +1002,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
10021002
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
10031003
# Test that the proxy environment variables are set correctly
10041004
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1005-
# Delete in case our environment has this set
1005+
# Delete in case our environment has any proxy env vars set
10061006
monkeypatch.delenv("HTTP_PROXY", raising=False)
1007+
monkeypatch.delenv("ALL_PROXY", raising=False)
1008+
monkeypatch.delenv("NO_PROXY", raising=False)
1009+
monkeypatch.delenv("http_proxy", raising=False)
1010+
monkeypatch.delenv("https_proxy", raising=False)
1011+
monkeypatch.delenv("all_proxy", raising=False)
1012+
monkeypatch.delenv("no_proxy", raising=False)
10071013

10081014
client = DefaultHttpxClient()
10091015

@@ -1955,8 +1961,14 @@ async def test_get_platform(self) -> None:
19551961
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19561962
# Test that the proxy environment variables are set correctly
19571963
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1958-
# Delete in case our environment has this set
1964+
# Delete in case our environment has any proxy env vars set
19591965
monkeypatch.delenv("HTTP_PROXY", raising=False)
1966+
monkeypatch.delenv("ALL_PROXY", raising=False)
1967+
monkeypatch.delenv("NO_PROXY", raising=False)
1968+
monkeypatch.delenv("http_proxy", raising=False)
1969+
monkeypatch.delenv("https_proxy", raising=False)
1970+
monkeypatch.delenv("all_proxy", raising=False)
1971+
monkeypatch.delenv("no_proxy", raising=False)
19601972

19611973
client = DefaultAsyncHttpxClient()
19621974

0 commit comments

Comments
 (0)