Skip to content

Commit ee15340

Browse files
chore(internal): make test_proxy_environment_variables more resilient to env
1 parent 04b1f9f commit ee15340

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

985991
client = DefaultHttpxClient()
986992

@@ -1913,8 +1919,14 @@ async def test_get_platform(self) -> None:
19131919
async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None:
19141920
# Test that the proxy environment variables are set correctly
19151921
monkeypatch.setenv("HTTPS_PROXY", "https://example.org")
1916-
# Delete in case our environment has this set
1922+
# Delete in case our environment has any proxy env vars set
19171923
monkeypatch.delenv("HTTP_PROXY", raising=False)
1924+
monkeypatch.delenv("ALL_PROXY", raising=False)
1925+
monkeypatch.delenv("NO_PROXY", raising=False)
1926+
monkeypatch.delenv("http_proxy", raising=False)
1927+
monkeypatch.delenv("https_proxy", raising=False)
1928+
monkeypatch.delenv("all_proxy", raising=False)
1929+
monkeypatch.delenv("no_proxy", raising=False)
19181930

19191931
client = DefaultAsyncHttpxClient()
19201932

0 commit comments

Comments
 (0)