Skip to content

Commit 487887e

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 821dd3f commit 487887e

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

10411047
client = DefaultHttpxClient()
10421048

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

20322044
client = DefaultAsyncHttpxClient()
20332045

0 commit comments

Comments
 (0)