Skip to content

Commit f3aa13b

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 09cfd99 commit f3aa13b

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
@@ -1171,8 +1171,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
11711171
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
11721172
# Test that the proxy environment variables are set correctly
11731173
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1174-
# Delete in case our environment has this set
1174+
# Delete in case our environment has any proxy env vars set
11751175
monkeypatch.delenv("HTTP_PROXY", raising=False)
1176+
monkeypatch.delenv("ALL_PROXY", raising=False)
1177+
monkeypatch.delenv("NO_PROXY", raising=False)
1178+
monkeypatch.delenv("http_proxy", raising=False)
1179+
monkeypatch.delenv("https_proxy", raising=False)
1180+
monkeypatch.delenv("all_proxy", raising=False)
1181+
monkeypatch.delenv("no_proxy", raising=False)
11761182

11771183
client = DefaultHttpxClient()
11781184

@@ -2304,8 +2310,14 @@ async def test_get_platform(self) -> None:
23042310
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
23052311
# Test that the proxy environment variables are set correctly
23062312
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
2307-
# Delete in case our environment has this set
2313+
# Delete in case our environment has any proxy env vars set
23082314
monkeypatch.delenv("HTTP_PROXY", raising=False)
2315+
monkeypatch.delenv("ALL_PROXY", raising=False)
2316+
monkeypatch.delenv("NO_PROXY", raising=False)
2317+
monkeypatch.delenv("http_proxy", raising=False)
2318+
monkeypatch.delenv("https_proxy", raising=False)
2319+
monkeypatch.delenv("all_proxy", raising=False)
2320+
monkeypatch.delenv("no_proxy", raising=False)
23092321

23102322
client = DefaultAsyncHttpxClient()
23112323

0 commit comments

Comments
 (0)