Skip to content

Commit e9e5e13

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

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

965971
client = DefaultHttpxClient()
966972

@@ -1879,8 +1885,14 @@ async def test_get_platform(self) -> None:
18791885
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18801886
# Test that the proxy environment variables are set correctly
18811887
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1882-
# Delete in case our environment has this set
1888+
# Delete in case our environment has any proxy env vars set
18831889
monkeypatch.delenv("HTTP_PROXY", raising=False)
1890+
monkeypatch.delenv("ALL_PROXY", raising=False)
1891+
monkeypatch.delenv("NO_PROXY", raising=False)
1892+
monkeypatch.delenv("http_proxy", raising=False)
1893+
monkeypatch.delenv("https_proxy", raising=False)
1894+
monkeypatch.delenv("all_proxy", raising=False)
1895+
monkeypatch.delenv("no_proxy", raising=False)
18841896

18851897
client = DefaultAsyncHttpxClient()
18861898

0 commit comments

Comments
 (0)