Skip to content

Commit 8f4eb86

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 465a08c commit 8f4eb86

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
@@ -1028,8 +1028,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
10281028
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
10291029
# Test that the proxy environment variables are set correctly
10301030
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1031-
# Delete in case our environment has this set
1031+
# Delete in case our environment has any proxy env vars set
10321032
monkeypatch.delenv("HTTP_PROXY", raising=False)
1033+
monkeypatch.delenv("ALL_PROXY", raising=False)
1034+
monkeypatch.delenv("NO_PROXY", raising=False)
1035+
monkeypatch.delenv("http_proxy", raising=False)
1036+
monkeypatch.delenv("https_proxy", raising=False)
1037+
monkeypatch.delenv("all_proxy", raising=False)
1038+
monkeypatch.delenv("no_proxy", raising=False)
10331039

10341040
client = DefaultHttpxClient()
10351041

@@ -2017,8 +2023,14 @@ async def test_get_platform(self) -> None:
20172023
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
20182024
# Test that the proxy environment variables are set correctly
20192025
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
2020-
# Delete in case our environment has this set
2026+
# Delete in case our environment has any proxy env vars set
20212027
monkeypatch.delenv("HTTP_PROXY", raising=False)
2028+
monkeypatch.delenv("ALL_PROXY", raising=False)
2029+
monkeypatch.delenv("NO_PROXY", raising=False)
2030+
monkeypatch.delenv("http_proxy", raising=False)
2031+
monkeypatch.delenv("https_proxy", raising=False)
2032+
monkeypatch.delenv("all_proxy", raising=False)
2033+
monkeypatch.delenv("no_proxy", raising=False)
20222034

20232035
client = DefaultAsyncHttpxClient()
20242036

0 commit comments

Comments
 (0)