Skip to content

Use UTF-8 when reading Bedrock test fixtures - #3530

Open
Ghraven wants to merge 1 commit into
openai:mainfrom
GhravenLabs:fix/bedrock-fixtures-utf8
Open

Use UTF-8 when reading Bedrock test fixtures#3530
Ghraven wants to merge 1 commit into
openai:mainfrom
GhravenLabs:fix/bedrock-fixtures-utf8

Conversation

@Ghraven

@Ghraven Ghraven commented Jul 23, 2026

Copy link
Copy Markdown

Summary

  • Read Bedrock JSON/JSONL fixture files with encoding="utf-8" instead of the platform default encoding.
  • Keep the opt-in Bedrock live env-file reader deterministic across developer machines.

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.py
  • uv 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)

@Ghraven
Ghraven requested a review from a team as a code owner July 23, 2026 04:28

@ting-hong-shieh ting-hong-shieh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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.

2 participants