Skip to content

Commit 6af2338

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 6f2864d commit 6af2338

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/test_client.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
962962
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
963963
# Test that the proxy environment variables are set correctly
964964
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
965-
# Delete in case our environment has this set
965+
# Delete in case our environment has any proxy env vars set
966966
monkeypatch.delenv("HTTP_PROXY", raising=False)
967+
monkeypatch.delenv("ALL_PROXY", raising=False)
968+
monkeypatch.delenv("NO_PROXY", raising=False)
969+
monkeypatch.delenv("http_proxy", raising=False)
970+
monkeypatch.delenv("https_proxy", raising=False)
971+
monkeypatch.delenv("all_proxy", raising=False)
972+
monkeypatch.delenv("no_proxy", raising=False)
967973

968974
client = DefaultHttpxClient()
969975

@@ -1885,8 +1891,14 @@ async def test_get_platform(self) -> None:
18851891
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18861892
# Test that the proxy environment variables are set correctly
18871893
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1888-
# Delete in case our environment has this set
1894+
# Delete in case our environment has any proxy env vars set
18891895
monkeypatch.delenv("HTTP_PROXY", raising=False)
1896+
monkeypatch.delenv("ALL_PROXY", raising=False)
1897+
monkeypatch.delenv("NO_PROXY", raising=False)
1898+
monkeypatch.delenv("http_proxy", raising=False)
1899+
monkeypatch.delenv("https_proxy", raising=False)
1900+
monkeypatch.delenv("all_proxy", raising=False)
1901+
monkeypatch.delenv("no_proxy", raising=False)
18901902

18911903
client = DefaultAsyncHttpxClient()
18921904

0 commit comments

Comments
 (0)