Skip to content

Commit 2520d14

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 4d2b021 commit 2520d14

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
@@ -981,8 +981,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
981981
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
982982
# Test that the proxy environment variables are set correctly
983983
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
984-
# Delete in case our environment has this set
984+
# Delete in case our environment has any proxy env vars set
985985
monkeypatch.delenv("HTTP_PROXY", raising=False)
986+
monkeypatch.delenv("ALL_PROXY", raising=False)
987+
monkeypatch.delenv("NO_PROXY", raising=False)
988+
monkeypatch.delenv("http_proxy", raising=False)
989+
monkeypatch.delenv("https_proxy", raising=False)
990+
monkeypatch.delenv("all_proxy", raising=False)
991+
monkeypatch.delenv("no_proxy", raising=False)
986992

987993
client = DefaultHttpxClient()
988994

@@ -1909,8 +1915,14 @@ async def test_get_platform(self) -> None:
19091915
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19101916
# Test that the proxy environment variables are set correctly
19111917
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1912-
# Delete in case our environment has this set
1918+
# Delete in case our environment has any proxy env vars set
19131919
monkeypatch.delenv("HTTP_PROXY", raising=False)
1920+
monkeypatch.delenv("ALL_PROXY", raising=False)
1921+
monkeypatch.delenv("NO_PROXY", raising=False)
1922+
monkeypatch.delenv("http_proxy", raising=False)
1923+
monkeypatch.delenv("https_proxy", raising=False)
1924+
monkeypatch.delenv("all_proxy", raising=False)
1925+
monkeypatch.delenv("no_proxy", raising=False)
19141926

19151927
client = DefaultAsyncHttpxClient()
19161928

0 commit comments

Comments
 (0)