Skip to content

Commit 1ad2ddf

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 5df69bf commit 1ad2ddf

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
@@ -984,8 +984,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
984984
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
985985
# Test that the proxy environment variables are set correctly
986986
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
987-
# Delete in case our environment has this set
987+
# Delete in case our environment has any proxy env vars set
988988
monkeypatch.delenv("HTTP_PROXY", raising=False)
989+
monkeypatch.delenv("ALL_PROXY", raising=False)
990+
monkeypatch.delenv("NO_PROXY", raising=False)
991+
monkeypatch.delenv("http_proxy", raising=False)
992+
monkeypatch.delenv("https_proxy", raising=False)
993+
monkeypatch.delenv("all_proxy", raising=False)
994+
monkeypatch.delenv("no_proxy", raising=False)
989995

990996
client = DefaultHttpxClient()
991997

@@ -1918,8 +1924,14 @@ async def test_get_platform(self) -> None:
19181924
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19191925
# Test that the proxy environment variables are set correctly
19201926
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1921-
# Delete in case our environment has this set
1927+
# Delete in case our environment has any proxy env vars set
19221928
monkeypatch.delenv("HTTP_PROXY", raising=False)
1929+
monkeypatch.delenv("ALL_PROXY", raising=False)
1930+
monkeypatch.delenv("NO_PROXY", raising=False)
1931+
monkeypatch.delenv("http_proxy", raising=False)
1932+
monkeypatch.delenv("https_proxy", raising=False)
1933+
monkeypatch.delenv("all_proxy", raising=False)
1934+
monkeypatch.delenv("no_proxy", raising=False)
19231935

19241936
client = DefaultAsyncHttpxClient()
19251937

0 commit comments

Comments
 (0)