Skip to content

Commit 60ab278

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 3608c6e commit 60ab278

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
@@ -947,8 +947,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
947947
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
948948
# Test that the proxy environment variables are set correctly
949949
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
950-
# Delete in case our environment has this set
950+
# Delete in case our environment has any proxy env vars set
951951
monkeypatch.delenv("HTTP_PROXY", raising=False)
952+
monkeypatch.delenv("ALL_PROXY", raising=False)
953+
monkeypatch.delenv("NO_PROXY", raising=False)
954+
monkeypatch.delenv("http_proxy", raising=False)
955+
monkeypatch.delenv("https_proxy", raising=False)
956+
monkeypatch.delenv("all_proxy", raising=False)
957+
monkeypatch.delenv("no_proxy", raising=False)
952958

953959
client = DefaultHttpxClient()
954960

@@ -1855,8 +1861,14 @@ async def test_get_platform(self) -> None:
18551861
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18561862
# Test that the proxy environment variables are set correctly
18571863
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1858-
# Delete in case our environment has this set
1864+
# Delete in case our environment has any proxy env vars set
18591865
monkeypatch.delenv("HTTP_PROXY", raising=False)
1866+
monkeypatch.delenv("ALL_PROXY", raising=False)
1867+
monkeypatch.delenv("NO_PROXY", raising=False)
1868+
monkeypatch.delenv("http_proxy", raising=False)
1869+
monkeypatch.delenv("https_proxy", raising=False)
1870+
monkeypatch.delenv("all_proxy", raising=False)
1871+
monkeypatch.delenv("no_proxy", raising=False)
18601872

18611873
client = DefaultAsyncHttpxClient()
18621874

0 commit comments

Comments
 (0)