Skip to content

Commit a9a701f

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 8d549cc commit a9a701f

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
@@ -953,8 +953,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
953953
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
954954
# Test that the proxy environment variables are set correctly
955955
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
956-
# Delete in case our environment has this set
956+
# Delete in case our environment has any proxy env vars set
957957
monkeypatch.delenv("HTTP_PROXY", raising=False)
958+
monkeypatch.delenv("ALL_PROXY", raising=False)
959+
monkeypatch.delenv("NO_PROXY", raising=False)
960+
monkeypatch.delenv("http_proxy", raising=False)
961+
monkeypatch.delenv("https_proxy", raising=False)
962+
monkeypatch.delenv("all_proxy", raising=False)
963+
monkeypatch.delenv("no_proxy", raising=False)
958964

959965
client = DefaultHttpxClient()
960966

@@ -1858,8 +1864,14 @@ async def test_get_platform(self) -> None:
18581864
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18591865
# Test that the proxy environment variables are set correctly
18601866
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1861-
# Delete in case our environment has this set
1867+
# Delete in case our environment has any proxy env vars set
18621868
monkeypatch.delenv("HTTP_PROXY", raising=False)
1869+
monkeypatch.delenv("ALL_PROXY", raising=False)
1870+
monkeypatch.delenv("NO_PROXY", raising=False)
1871+
monkeypatch.delenv("http_proxy", raising=False)
1872+
monkeypatch.delenv("https_proxy", raising=False)
1873+
monkeypatch.delenv("all_proxy", raising=False)
1874+
monkeypatch.delenv("no_proxy", raising=False)
18631875

18641876
client = DefaultAsyncHttpxClient()
18651877

0 commit comments

Comments
 (0)