From 163af0c2aed98af40db1786aa0e9a46d75eab436 Mon Sep 17 00:00:00 2001 From: Mohammed Alkindi Date: Sun, 16 Aug 2026 23:37:04 +0400 Subject: [PATCH 1/2] fix(tests): keep base64 fixture LF on Windows checkouts tests/sample_file.txt is asserted on byte-for-byte by the base64 transform tests, but with core.autocrlf (the Git for Windows default) a fresh clone rewrites it to CRLF and both test_base64_file_input variants fail. Mark the fixture -text so every platform checks out the exact committed bytes. --- .gitattributes | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitattributes 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 From 1aae995a2f55d3613f45595c2593970ac5db3443 Mon Sep 17 00:00:00 2001 From: Mohammed Alkindi Date: Sun, 16 Aug 2026 23:37:15 +0400 Subject: [PATCH 2/2] fix(tests): set HTTPS_PROXY after deleting lowercase proxy vars test_proxy_environment_variables set HTTPS_PROXY first and then deleted the lowercase variants as cleanup. os.environ is case-insensitive on Windows, so delenv("https_proxy") also removed the HTTPS_PROXY that was just set, the client saw no proxy in the environment, and the mounts assertion failed. Do the cleanup first and set the variable afterwards. --- tests/test_client.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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()