diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..81a2de4370 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# The base64 tests assert on this fixture's exact bytes, so it must not be +# rewritten to CRLF on checkout (the default on Windows with core.autocrlf). +tests/sample_file.txt -text diff --git a/tests/test_client.py b/tests/test_client.py index 79a66098fa..5c29f246de 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -1324,8 +1324,9 @@ def retry_handler(_request: httpx2.Request) -> httpx2.Response: def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly - monkeypatch.setenv("HTTPS_PROXY", "https://example.org") - # Delete in case our environment has any proxy env vars set + # Delete in case our environment has any proxy env vars set. This must + # happen before setting HTTPS_PROXY: os.environ is case-insensitive on + # Windows, so deleting "https_proxy" afterwards would remove it again. monkeypatch.delenv("HTTP_PROXY", raising=False) monkeypatch.delenv("ALL_PROXY", raising=False) monkeypatch.delenv("NO_PROXY", raising=False) @@ -1333,6 +1334,7 @@ def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> N monkeypatch.delenv("https_proxy", raising=False) monkeypatch.delenv("all_proxy", raising=False) monkeypatch.delenv("no_proxy", raising=False) + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") client = DefaultHttpxClient() @@ -2625,8 +2627,9 @@ async def test_get_platform(self) -> None: async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: # Test that the proxy environment variables are set correctly - monkeypatch.setenv("HTTPS_PROXY", "https://example.org") - # Delete in case our environment has any proxy env vars set + # Delete in case our environment has any proxy env vars set. This must + # happen before setting HTTPS_PROXY: os.environ is case-insensitive on + # Windows, so deleting "https_proxy" afterwards would remove it again. monkeypatch.delenv("HTTP_PROXY", raising=False) monkeypatch.delenv("ALL_PROXY", raising=False) monkeypatch.delenv("NO_PROXY", raising=False) @@ -2634,6 +2637,7 @@ async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch monkeypatch.delenv("https_proxy", raising=False) monkeypatch.delenv("all_proxy", raising=False) monkeypatch.delenv("no_proxy", raising=False) + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") client = DefaultAsyncHttpxClient()