Skip to content

Commit 8673314

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 2a2ba8f commit 8673314

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
@@ -989,8 +989,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
989989
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
990990
# Test that the proxy environment variables are set correctly
991991
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
992-
# Delete in case our environment has this set
992+
# Delete in case our environment has any proxy env vars set
993993
monkeypatch.delenv("HTTP_PROXY", raising=False)
994+
monkeypatch.delenv("ALL_PROXY", raising=False)
995+
monkeypatch.delenv("NO_PROXY", raising=False)
996+
monkeypatch.delenv("http_proxy", raising=False)
997+
monkeypatch.delenv("https_proxy", raising=False)
998+
monkeypatch.delenv("all_proxy", raising=False)
999+
monkeypatch.delenv("no_proxy", raising=False)
9941000

9951001
client = DefaultHttpxClient()
9961002

@@ -1933,8 +1939,14 @@ async def test_get_platform(self) -> None:
19331939
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19341940
# Test that the proxy environment variables are set correctly
19351941
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1936-
# Delete in case our environment has this set
1942+
# Delete in case our environment has any proxy env vars set
19371943
monkeypatch.delenv("HTTP_PROXY", raising=False)
1944+
monkeypatch.delenv("ALL_PROXY", raising=False)
1945+
monkeypatch.delenv("NO_PROXY", raising=False)
1946+
monkeypatch.delenv("http_proxy", raising=False)
1947+
monkeypatch.delenv("https_proxy", raising=False)
1948+
monkeypatch.delenv("all_proxy", raising=False)
1949+
monkeypatch.delenv("no_proxy", raising=False)
19381950

19391951
client = DefaultAsyncHttpxClient()
19401952

0 commit comments

Comments
 (0)