Skip to content

Commit 12600f1

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 548c10c commit 12600f1

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
@@ -922,8 +922,14 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
922922
def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
923923
# Test that the proxy environment variables are set correctly
924924
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
925-
# Delete in case our environment has this set
925+
# Delete in case our environment has any proxy env vars set
926926
monkeypatch.delenv("HTTP_PROXY", raising=False)
927+
monkeypatch.delenv("ALL_PROXY", raising=False)
928+
monkeypatch.delenv("NO_PROXY", raising=False)
929+
monkeypatch.delenv("http_proxy", raising=False)
930+
monkeypatch.delenv("https_proxy", raising=False)
931+
monkeypatch.delenv("all_proxy", raising=False)
932+
monkeypatch.delenv("no_proxy", raising=False)
927933

928934
client = DefaultHttpxClient()
929935

@@ -1811,8 +1817,14 @@ async def test_get_platform(self) -> None:
18111817
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
18121818
# Test that the proxy environment variables are set correctly
18131819
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1814-
# Delete in case our environment has this set
1820+
# Delete in case our environment has any proxy env vars set
18151821
monkeypatch.delenv("HTTP_PROXY", raising=False)
1822+
monkeypatch.delenv("ALL_PROXY", raising=False)
1823+
monkeypatch.delenv("NO_PROXY", raising=False)
1824+
monkeypatch.delenv("http_proxy", raising=False)
1825+
monkeypatch.delenv("https_proxy", raising=False)
1826+
monkeypatch.delenv("all_proxy", raising=False)
1827+
monkeypatch.delenv("no_proxy", raising=False)
18161828

18171829
client = DefaultAsyncHttpxClient()
18181830

0 commit comments

Comments
 (0)