Skip to content

Commit a2da977

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

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
@@ -993,8 +993,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
993993
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
994994
# Test that the proxy environment variables are set correctly
995995
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
996-
# Delete in case our environment has this set
996+
# Delete in case our environment has any proxy env vars set
997997
monkeypatch.delenv("HTTP_PROXY", raising=False)
998+
monkeypatch.delenv("ALL_PROXY", raising=False)
999+
monkeypatch.delenv("NO_PROXY", raising=False)
1000+
monkeypatch.delenv("http_proxy", raising=False)
1001+
monkeypatch.delenv("https_proxy", raising=False)
1002+
monkeypatch.delenv("all_proxy", raising=False)
1003+
monkeypatch.delenv("no_proxy", raising=False)
9981004

9991005
client = DefaultHttpxClient()
10001006

@@ -1949,8 +1955,14 @@ async def test_get_platform(self) -> None:
19491955
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19501956
# Test that the proxy environment variables are set correctly
19511957
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1952-
# Delete in case our environment has this set
1958+
# Delete in case our environment has any proxy env vars set
19531959
monkeypatch.delenv("HTTP_PROXY", raising=False)
1960+
monkeypatch.delenv("ALL_PROXY", raising=False)
1961+
monkeypatch.delenv("NO_PROXY", raising=False)
1962+
monkeypatch.delenv("http_proxy", raising=False)
1963+
monkeypatch.delenv("https_proxy", raising=False)
1964+
monkeypatch.delenv("all_proxy", raising=False)
1965+
monkeypatch.delenv("no_proxy", raising=False)
19541966

19551967
client = DefaultAsyncHttpxClient()
19561968

0 commit comments

Comments
 (0)