Skip to content

[CB-0] [sdk-superfan] Make the base64 and proxy tests pass on Windows checkouts - #224

Draft
spicysouvlaki wants to merge 1 commit into
mainfrom
wschmitt/tests-windows-determinism
Draft

spicysouvlaki wants to merge 1 commit into
mainfrom
wschmitt/tests-windows-determinism

Conversation

@spicysouvlaki

@spicysouvlaki spicysouvlaki commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

What happened

#181. On Windows, 4 tests fail: test_base64_file_input produces SGVsbG8sIHdvcmxkIQ0K where the test expects SGVsbG8sIHdvcmxkIQo=, and test_proxy_environment_variables fails assert len(mounts) == 1. Each runs sync and async.

Why

Fix

  • Add a .gitattributes entry, tests/sample_file.txt -text.
  • Set HTTPS_PROXY after the deletes.

Tests

  • CRLF, reproduced with git -c core.autocrlf=true checkout -- tests/sample_file.txt. Before the fix the file ends in 0d0a and 2 tests fail. After, it ends in 0a and 2 pass.
  • Proxy, reproduced with a pytest plugin that upper-cases os.environ keys the way CPython does on Windows. Before the fix: 2 failed. After: 2 passed.
  • ./scripts/lint: clean. ./scripts/test (py3.9 pydantic v2/v1, py3.14): all pass.
  • Not run: a real Windows machine or a Windows CI job.

Risk and rollout

tests/test_client.py is generated, and this is a sealed 2-line edit. The same code exists upstream, so a regen may conflict there. .gitattributes is a new custom file. Nothing ships to users.

Refs #181

🤖 Generated with Claude Code

Two Windows-only failures:

1. test_base64_file_input hard-codes the base64 of "Hello, world!\n". With
   core.autocrlf=true (the Git for Windows default) tests/sample_file.txt is
   checked out with CRLF and the encoding becomes ...IQ0K. Reproduced on macOS
   with `git -c core.autocrlf=true checkout -- tests/sample_file.txt`: bytes
   end 0d0a, both cases fail. `.gitattributes` now marks the fixture
   `-text`, so it keeps LF everywhere; same checkout ends 0a, both pass.

2. test_proxy_environment_variables sets HTTPS_PROXY and then deletes
   `https_proxy`. Windows env vars are case-insensitive (CPython's nt
   os.environ upper-cases keys), so that delete removes the variable the
   test just set, httpx sees no env proxy, and `len(mounts) == 1` fails.
   Reproduced on macOS by loading a pytest plugin that upper-cases
   os.environ keys the way nt does: 2 failed before, 2 passed after setting
   HTTPS_PROXY last.

Not reproduced: the report's claim that an inherited NO_PROXY breaks the
proxy test. The test already deletes NO_PROXY/no_proxy; only a mixed-case
`No_Proxy` on POSIX survives that, which is not a real-world setup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant