Skip to content

Commit de89dcf

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

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
@@ -1038,8 +1038,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
10381038
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
10391039
# Test that the proxy environment variables are set correctly
10401040
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1041-
# Delete in case our environment has this set
1041+
# Delete in case our environment has any proxy env vars set
10421042
monkeypatch.delenv("HTTP_PROXY", raising=False)
1043+
monkeypatch.delenv("ALL_PROXY", raising=False)
1044+
monkeypatch.delenv("NO_PROXY", raising=False)
1045+
monkeypatch.delenv("http_proxy", raising=False)
1046+
monkeypatch.delenv("https_proxy", raising=False)
1047+
monkeypatch.delenv("all_proxy", raising=False)
1048+
monkeypatch.delenv("no_proxy", raising=False)
10431049

10441050
client = DefaultHttpxClient()
10451051

@@ -2028,8 +2034,14 @@ async def test_get_platform(self) -> None:
20282034
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
20292035
# Test that the proxy environment variables are set correctly
20302036
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
2031-
# Delete in case our environment has this set
2037+
# Delete in case our environment has any proxy env vars set
20322038
monkeypatch.delenv("HTTP_PROXY", raising=False)
2039+
monkeypatch.delenv("ALL_PROXY", raising=False)
2040+
monkeypatch.delenv("NO_PROXY", raising=False)
2041+
monkeypatch.delenv("http_proxy", raising=False)
2042+
monkeypatch.delenv("https_proxy", raising=False)
2043+
monkeypatch.delenv("all_proxy", raising=False)
2044+
monkeypatch.delenv("no_proxy", raising=False)
20332045

20342046
client = DefaultAsyncHttpxClient()
20352047

0 commit comments

Comments
 (0)