Skip to content

Commit dd8ca18

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent b0a3688 commit dd8ca18

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

973979
client = DefaultHttpxClient()
974980

@@ -1895,8 +1901,14 @@ async def test_get_platform(self) -> None:
18951901
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18961902
# Test that the proxy environment variables are set correctly
18971903
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1898-
# Delete in case our environment has this set
1904+
# Delete in case our environment has any proxy env vars set
18991905
monkeypatch.delenv("HTTP_PROXY", raising=False)
1906+
monkeypatch.delenv("ALL_PROXY", raising=False)
1907+
monkeypatch.delenv("NO_PROXY", raising=False)
1908+
monkeypatch.delenv("http_proxy", raising=False)
1909+
monkeypatch.delenv("https_proxy", raising=False)
1910+
monkeypatch.delenv("all_proxy", raising=False)
1911+
monkeypatch.delenv("no_proxy", raising=False)
19001912

19011913
client = DefaultAsyncHttpxClient()
19021914

0 commit comments

Comments
 (0)