Use UTF-8 when reading Bedrock test fixtures - #3530
Open
Ghraven wants to merge 1 commit into
Open
Conversation
ting-hong-shieh
approved these changes
Aug 14, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)