Skip to content

Commit 0f56565

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 2782e14 commit 0f56565

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

963969
client = DefaultHttpxClient()
964970

@@ -1871,8 +1877,14 @@ async def test_get_platform(self) -> None:
18711877
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18721878
# Test that the proxy environment variables are set correctly
18731879
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1874-
# Delete in case our environment has this set
1880+
# Delete in case our environment has any proxy env vars set
18751881
monkeypatch.delenv("HTTP_PROXY", raising=False)
1882+
monkeypatch.delenv("ALL_PROXY", raising=False)
1883+
monkeypatch.delenv("NO_PROXY", raising=False)
1884+
monkeypatch.delenv("http_proxy", raising=False)
1885+
monkeypatch.delenv("https_proxy", raising=False)
1886+
monkeypatch.delenv("all_proxy", raising=False)
1887+
monkeypatch.delenv("no_proxy", raising=False)
18761888

18771889
client = DefaultAsyncHttpxClient()
18781890

0 commit comments

Comments
 (0)