Skip to content

Commit de673c8

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

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
@@ -943,8 +943,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
943943
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
944944
# Test that the proxy environment variables are set correctly
945945
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
946-
# Delete in case our environment has this set
946+
# Delete in case our environment has any proxy env vars set
947947
monkeypatch.delenv("HTTP_PROXY", raising=False)
948+
monkeypatch.delenv("ALL_PROXY", raising=False)
949+
monkeypatch.delenv("NO_PROXY", raising=False)
950+
monkeypatch.delenv("http_proxy", raising=False)
951+
monkeypatch.delenv("https_proxy", raising=False)
952+
monkeypatch.delenv("all_proxy", raising=False)
953+
monkeypatch.delenv("no_proxy", raising=False)
948954

949955
client = DefaultHttpxClient()
950956

@@ -1845,8 +1851,14 @@ async def test_get_platform(self) -> None:
18451851
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18461852
# Test that the proxy environment variables are set correctly
18471853
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1848-
# Delete in case our environment has this set
1854+
# Delete in case our environment has any proxy env vars set
18491855
monkeypatch.delenv("HTTP_PROXY", raising=False)
1856+
monkeypatch.delenv("ALL_PROXY", raising=False)
1857+
monkeypatch.delenv("NO_PROXY", raising=False)
1858+
monkeypatch.delenv("http_proxy", raising=False)
1859+
monkeypatch.delenv("https_proxy", raising=False)
1860+
monkeypatch.delenv("all_proxy", raising=False)
1861+
monkeypatch.delenv("no_proxy", raising=False)
18501862

18511863
client = DefaultAsyncHttpxClient()
18521864

0 commit comments

Comments
 (0)