Skip to content

Commit 9f092c7

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent e33584f commit 9f092c7

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
@@ -1089,8 +1089,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
10891089
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
10901090
# Test that the proxy environment variables are set correctly
10911091
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1092-
# Delete in case our environment has this set
1092+
# Delete in case our environment has any proxy env vars set
10931093
monkeypatch.delenv("HTTP_PROXY", raising=False)
1094+
monkeypatch.delenv("ALL_PROXY", raising=False)
1095+
monkeypatch.delenv("NO_PROXY", raising=False)
1096+
monkeypatch.delenv("http_proxy", raising=False)
1097+
monkeypatch.delenv("https_proxy", raising=False)
1098+
monkeypatch.delenv("all_proxy", raising=False)
1099+
monkeypatch.delenv("no_proxy", raising=False)
10941100

10951101
client = DefaultHttpxClient()
10961102

@@ -2133,8 +2139,14 @@ async def test_get_platform(self) -> None:
21332139
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
21342140
# Test that the proxy environment variables are set correctly
21352141
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
2136-
# Delete in case our environment has this set
2142+
# Delete in case our environment has any proxy env vars set
21372143
monkeypatch.delenv("HTTP_PROXY", raising=False)
2144+
monkeypatch.delenv("ALL_PROXY", raising=False)
2145+
monkeypatch.delenv("NO_PROXY", raising=False)
2146+
monkeypatch.delenv("http_proxy", raising=False)
2147+
monkeypatch.delenv("https_proxy", raising=False)
2148+
monkeypatch.delenv("all_proxy", raising=False)
2149+
monkeypatch.delenv("no_proxy", raising=False)
21382150

21392151
client = DefaultAsyncHttpxClient()
21402152

0 commit comments

Comments
 (0)