Skip to content

Commit b7ecf85

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 481029b commit b7ecf85

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

957963
client = DefaultHttpxClient()
958964

@@ -1863,8 +1869,14 @@ async def test_get_platform(self) -> None:
18631869
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18641870
# Test that the proxy environment variables are set correctly
18651871
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1866-
# Delete in case our environment has this set
1872+
# Delete in case our environment has any proxy env vars set
18671873
monkeypatch.delenv("HTTP_PROXY", raising=False)
1874+
monkeypatch.delenv("ALL_PROXY", raising=False)
1875+
monkeypatch.delenv("NO_PROXY", raising=False)
1876+
monkeypatch.delenv("http_proxy", raising=False)
1877+
monkeypatch.delenv("https_proxy", raising=False)
1878+
monkeypatch.delenv("all_proxy", raising=False)
1879+
monkeypatch.delenv("no_proxy", raising=False)
18681880

18691881
client = DefaultAsyncHttpxClient()
18701882

0 commit comments

Comments
 (0)