Skip to content

Commit fd1a06e

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 9fb0542 commit fd1a06e

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
@@ -955,8 +955,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
955955
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
956956
# Test that the proxy environment variables are set correctly
957957
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
958-
# Delete in case our environment has this set
958+
# Delete in case our environment has any proxy env vars set
959959
monkeypatch.delenv("HTTP_PROXY", raising=False)
960+
monkeypatch.delenv("ALL_PROXY", raising=False)
961+
monkeypatch.delenv("NO_PROXY", raising=False)
962+
monkeypatch.delenv("http_proxy", raising=False)
963+
monkeypatch.delenv("https_proxy", raising=False)
964+
monkeypatch.delenv("all_proxy", raising=False)
965+
monkeypatch.delenv("no_proxy", raising=False)
960966

961967
client = DefaultHttpxClient()
962968

@@ -1914,8 +1920,14 @@ async def test_main() -> None:
19141920
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19151921
# Test that the proxy environment variables are set correctly
19161922
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1917-
# Delete in case our environment has this set
1923+
# Delete in case our environment has any proxy env vars set
19181924
monkeypatch.delenv("HTTP_PROXY", raising=False)
1925+
monkeypatch.delenv("ALL_PROXY", raising=False)
1926+
monkeypatch.delenv("NO_PROXY", raising=False)
1927+
monkeypatch.delenv("http_proxy", raising=False)
1928+
monkeypatch.delenv("https_proxy", raising=False)
1929+
monkeypatch.delenv("all_proxy", raising=False)
1930+
monkeypatch.delenv("no_proxy", raising=False)
19191931

19201932
client = DefaultAsyncHttpxClient()
19211933

0 commit comments

Comments
 (0)