Skip to content

Commit ee9ae9e

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 09dfc73 commit ee9ae9e

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

960966
client = DefaultHttpxClient()
961967

@@ -1867,8 +1873,14 @@ async def test_get_platform(self) -> None:
18671873
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18681874
# Test that the proxy environment variables are set correctly
18691875
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1870-
# Delete in case our environment has this set
1876+
# Delete in case our environment has any proxy env vars set
18711877
monkeypatch.delenv("HTTP_PROXY", raising=False)
1878+
monkeypatch.delenv("ALL_PROXY", raising=False)
1879+
monkeypatch.delenv("NO_PROXY", raising=False)
1880+
monkeypatch.delenv("http_proxy", raising=False)
1881+
monkeypatch.delenv("https_proxy", raising=False)
1882+
monkeypatch.delenv("all_proxy", raising=False)
1883+
monkeypatch.delenv("no_proxy", raising=False)
18721884

18731885
client = DefaultAsyncHttpxClient()
18741886

0 commit comments

Comments
 (0)