Skip to content

fix(tests): make the test suite pass on a default Windows checkout - #3634

Open
MohammedAlkindi wants to merge 3 commits into
openai:mainfrom
MohammedAlkindi:fix/windows-test-checkout
Open

MohammedAlkindi wants to merge 3 commits into
openai:mainfrom
MohammedAlkindi:fix/windows-test-checkout

Conversation

@MohammedAlkindi

@MohammedAlkindi MohammedAlkindi commented Aug 16, 2026 •

Copy link
Copy Markdown
  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

On a fresh Windows clone with default Git settings, four tests fail before any change:

FAILED tests/test_client.py::TestOpenAI::test_proxy_environment_variables
FAILED tests/test_client.py::TestAsyncOpenAI::test_proxy_environment_variables
FAILED tests/test_transform.py::test_base64_file_input[sync]
FAILED tests/test_transform.py::test_base64_file_input[async]

test_base64_file_input asserts the exact bytes of tests/sample_file.txt, but core.autocrlf=true checks it out as CRLF. A new .gitattributes marks that one file -text; the committed blob is already LF.

test_proxy_environment_variables sets HTTPS_PROXY and then deletes the lowercase variants. os.environ is case-insensitive on Windows, so the delete also removes HTTPS_PROXY and the client sees no proxy. The cleanup now runs before setenv; on POSIX the order makes no difference.

After both changes the four tests pass, and tests/test_client.py plus tests/test_transform.py give 254 passed, 2 skipped.

Additional context & links

No generated file is touched: tests/test_client.py has no Castiron generated-file banner and .gitattributes is new. Seen on Windows 11 with git 2.53.0.windows.2 and Python 3.12.10.

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.
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.
@MohammedAlkindi
MohammedAlkindi requested a review from a team as a code owner August 16, 2026 19:39
@github-actions

Copy link
Copy Markdown
Contributor

Castiron custom code

✅ No new custom-code files detected.

34 mixed files remain; 0 existing customizations changed.

Compared 9917c6e28e66 → 887a261ed6a6. Generated baselines verified.

34 existing customizations unchanged
  • api.md
  • scripts/castiron/README.md
  • scripts/castiron/custom_code_report.py
  • scripts/castiron/test_custom_code_report.py
  • src/openai/init.py
  • src/openai/_client.py
  • src/openai/resources/audio/transcriptions.py
  • src/openai/resources/audio/translations.py
  • src/openai/resources/beta/beta.py
  • src/openai/resources/beta/responses/responses.py
  • src/openai/resources/beta/threads/runs/runs.py
  • src/openai/resources/beta/threads/threads.py
  • src/openai/resources/chat/completions/completions.py
  • src/openai/resources/embeddings.py
  • src/openai/resources/files.py
  • src/openai/resources/realtime/realtime.py
  • src/openai/resources/responses/responses.py
  • src/openai/resources/uploads/uploads.py
  • src/openai/resources/vector_stores/file_batches.py
  • src/openai/resources/vector_stores/files.py
  • src/openai/resources/videos.py
  • src/openai/resources/webhooks/init.py
  • src/openai/resources/webhooks/webhooks.py
  • src/openai/types/chat/init.py
  • src/openai/types/chat/chat_completion_message_tool_call.py
  • src/openai/types/fine_tuning/fine_tuning_job_integration.py
  • src/openai/types/responses/init.py
  • src/openai/types/responses/response.py
  • src/openai/types/responses/response_function_web_search.py
  • src/openai/types/responses/response_function_web_search_param.py
  • src/openai/types/responses/tool.py
  • src/openai/types/responses/tool_param.py
  • src/openai/types/webhooks/init.py
  • tests/api_resources/test_videos.py

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 36284037941 --repo openai/openai-python \
  --name castiron-custom-code-36284037941-1 --dir /tmp/castiron-custom-code-36284037941-1
git apply --stat /tmp/castiron-custom-code-36284037941-1/custom-code.patch
cat /tmp/castiron-custom-code-36284037941-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 9917c6e28e66e90e1227b3d223c06a8c5441515a 887a261ed6a66b81e4dc08a481683a3adf2cb541
python3 scripts/castiron/custom_code_report.py report \
  --base 9917c6e28e66e90e1227b3d223c06a8c5441515a \
  --head 887a261ed6a66b81e4dc08a481683a3adf2cb541 --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-887a261ed6a6
cat /tmp/castiron-custom-code-887a261ed6a6/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

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