Skip to content

Commit 3b07dd7

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 3247c6e commit 3b07dd7

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
@@ -982,8 +982,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
982982
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
983983
# Test that the proxy environment variables are set correctly
984984
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
985-
# Delete in case our environment has this set
985+
# Delete in case our environment has any proxy env vars set
986986
monkeypatch.delenv("HTTP_PROXY", raising=False)
987+
monkeypatch.delenv("ALL_PROXY", raising=False)
988+
monkeypatch.delenv("NO_PROXY", raising=False)
989+
monkeypatch.delenv("http_proxy", raising=False)
990+
monkeypatch.delenv("https_proxy", raising=False)
991+
monkeypatch.delenv("all_proxy", raising=False)
992+
monkeypatch.delenv("no_proxy", raising=False)
987993

988994
client = DefaultHttpxClient()
989995

@@ -1925,8 +1931,14 @@ async def test_get_platform(self) -> None:
19251931
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19261932
# Test that the proxy environment variables are set correctly
19271933
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1928-
# Delete in case our environment has this set
1934+
# Delete in case our environment has any proxy env vars set
19291935
monkeypatch.delenv("HTTP_PROXY", raising=False)
1936+
monkeypatch.delenv("ALL_PROXY", raising=False)
1937+
monkeypatch.delenv("NO_PROXY", raising=False)
1938+
monkeypatch.delenv("http_proxy", raising=False)
1939+
monkeypatch.delenv("https_proxy", raising=False)
1940+
monkeypatch.delenv("all_proxy", raising=False)
1941+
monkeypatch.delenv("no_proxy", raising=False)
19301942

19311943
client = DefaultAsyncHttpxClient()
19321944

0 commit comments

Comments
 (0)