Repository navigation
Use UTF-8 when reading Bedrock test fixtures - #3530
Conversation
ting-hong-shieh
left a comment
There was a problem hiding this comment.
Reviewed base e67afa88, head ba3c6562, and clean synthetic merge 63c91cde with current main d9029e3a.
Using the same UTF-8 env file (# café plus an ASCII assignment) in a real LC_ALL=C, UTF-8-mode-disabled subprocess:
base: {"exception": "UnicodeDecodeError", "status": "error"}
head: {"status": "ok", "value": "ok"}
current-main merge: {"status": "ok", "value": "ok"}
The 20 Bedrock auth conformance tests pass on both the exact head and current-main merge. Ruff lint/format, py_compile, and git diff --check also pass for the two touched files. No AWS or OpenAI API call, credentials, or external runtime service was used. I did not find a blocking issue.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Thanks for the fix! Explicit UTF-8 makes sense for these files. I checked the patch against current main, and the Bedrock conformance tests pass. Looks good to me as-is. |
Castiron custom codeEvaluated main: Trusted main policy: ✅ No new custom-code files detected. 0 mixed files remain; 0 existing customizations changed. Compared A changed generated baseline means this report cannot reliably identify which handwritten lines changed. Inspect the custom-code diffDownload the exact patch produced by this run (requires repository access): gh run download 40039656026 --repo openai/openai-python \
--name castiron-custom-code-40039656026-1 --dir /tmp/castiron-custom-code-40039656026-1
git apply --stat /tmp/castiron-custom-code-40039656026-1/custom-code.patch
cat /tmp/castiron-custom-code-40039656026-1/custom-code.patchOr reproduce it from an SDK checkout containing the vendored reporter: git fetch --no-tags origin 43045fcaf91aec08571e54c57706597cefd32d45 68227bea4e1eb79f7fac9cf7a555f2ca3b8677df
python3 scripts/castiron/custom_code_report.py report \
--base 43045fcaf91aec08571e54c57706597cefd32d45 \
--head 68227bea4e1eb79f7fac9cf7a555f2ca3b8677df --target-branch main --fetch --require-head-hash --public \
--out /tmp/castiron-custom-code-68227bea4e1e
cat /tmp/castiron-custom-code-68227bea4e1e/custom-code.patchThis is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR. |
Summary
encoding="utf-8"instead of the platform default encoding.Problem
These test fixtures and optional live-test env files are text inputs with repo-controlled formats, but
Path.read_text()defaults to the host locale. On Windows or other non-UTF-8 locales, that can make the Bedrock tests less portable than they need to be.Before / After
Before: Bedrock fixture loading depended on the platform default text encoding.
After: the fixture and env-file readers explicitly decode as UTF-8.
Verification
python -m py_compile tests/lib/test_bedrock_auth_conformance.py tests/lib/bedrock_live.pyuv run --with pytest --with pytest-asyncio --with pytest-xdist --with jsonschema --with respx --with botocore python -m pytest -q tests/lib/test_bedrock_auth_conformance.py(20 passed)