Skip to content

Commit cdfe354

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 01c51e5 commit cdfe354

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
@@ -965,8 +965,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
965965
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
966966
# Test that the proxy environment variables are set correctly
967967
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
968-
# Delete in case our environment has this set
968+
# Delete in case our environment has any proxy env vars set
969969
monkeypatch.delenv("HTTP_PROXY", raising=False)
970+
monkeypatch.delenv("ALL_PROXY", raising=False)
971+
monkeypatch.delenv("NO_PROXY", raising=False)
972+
monkeypatch.delenv("http_proxy", raising=False)
973+
monkeypatch.delenv("https_proxy", raising=False)
974+
monkeypatch.delenv("all_proxy", raising=False)
975+
monkeypatch.delenv("no_proxy", raising=False)
970976

971977
client = DefaultHttpxClient()
972978

@@ -1889,8 +1895,14 @@ async def test_get_platform(self) -> None:
18891895
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18901896
# Test that the proxy environment variables are set correctly
18911897
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1892-
# Delete in case our environment has this set
1898+
# Delete in case our environment has any proxy env vars set
18931899
monkeypatch.delenv("HTTP_PROXY", raising=False)
1900+
monkeypatch.delenv("ALL_PROXY", raising=False)
1901+
monkeypatch.delenv("NO_PROXY", raising=False)
1902+
monkeypatch.delenv("http_proxy", raising=False)
1903+
monkeypatch.delenv("https_proxy", raising=False)
1904+
monkeypatch.delenv("all_proxy", raising=False)
1905+
monkeypatch.delenv("no_proxy", raising=False)
18941906

18951907
client = DefaultAsyncHttpxClient()
18961908

0 commit comments

Comments
 (0)