Skip to content

Commit d60d095

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent b33f0fb commit d60d095

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
@@ -1070,8 +1070,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
10701070
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
10711071
# Test that the proxy environment variables are set correctly
10721072
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1073-
# Delete in case our environment has this set
1073+
# Delete in case our environment has any proxy env vars set
10741074
monkeypatch.delenv("HTTP_PROXY", raising=False)
1075+
monkeypatch.delenv("ALL_PROXY", raising=False)
1076+
monkeypatch.delenv("NO_PROXY", raising=False)
1077+
monkeypatch.delenv("http_proxy", raising=False)
1078+
monkeypatch.delenv("https_proxy", raising=False)
1079+
monkeypatch.delenv("all_proxy", raising=False)
1080+
monkeypatch.delenv("no_proxy", raising=False)
10751081

10761082
client = DefaultHttpxClient()
10771083

@@ -2090,8 +2096,14 @@ async def test_get_platform(self) -> None:
20902096
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
20912097
# Test that the proxy environment variables are set correctly
20922098
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
2093-
# Delete in case our environment has this set
2099+
# Delete in case our environment has any proxy env vars set
20942100
monkeypatch.delenv("HTTP_PROXY", raising=False)
2101+
monkeypatch.delenv("ALL_PROXY", raising=False)
2102+
monkeypatch.delenv("NO_PROXY", raising=False)
2103+
monkeypatch.delenv("http_proxy", raising=False)
2104+
monkeypatch.delenv("https_proxy", raising=False)
2105+
monkeypatch.delenv("all_proxy", raising=False)
2106+
monkeypatch.delenv("no_proxy", raising=False)
20952107

20962108
client = DefaultAsyncHttpxClient()
20972109

0 commit comments

Comments
 (0)