Skip to content

Make the writer datetime test independent of local timezone - #32

Open
saitakarcesme wants to merge 2 commits into
python-lsp:developfrom
saitakarcesme:codex/timezone-independent-writer-test
Open

saitakarcesme wants to merge 2 commits into
python-lsp:developfrom
saitakarcesme:codex/timezone-independent-writer-test

Conversation

@saitakarcesme

@saitakarcesme saitakarcesme commented Sep 22, 2026 •

Copy link
Copy Markdown

Fixes #6. test_writer_bad_message calls timestamp() on a naive datetime, so its expected bytes depend on the host timezone. The two hard-coded timestamps only cover some environments; adding another timestamp as in the closed #7 would leave the underlying problem.

Use a UTC-aware JsonDatetime and keep a single timestamp expectation (1546304461), while retaining the existing empty-output allowance for the standard JSON fallback. Instantiate the subclass directly instead of permanently replacing the global datetime.datetime class.

Validation on Python 3.13.5:

  • Before the change, the test passes in UTC and America/New_York but fails in Europe/Luxembourg, Asia/Kathmandu and Pacific/Chatham.
  • After the change, all 27 tests pass in each of those five timezones with both ujson 6.0.0 and the standard-library JSON fallback (10 separate processes). Also verified datetime.datetime retains its original identity after each suite run.
  • Repository-wide pylint (10.00/10), pycodestyle, pyflakes and git diff --check pass.

This changes tests and macOS CI only; it does not alter production serialization or the separate orjson migration in #29. No Windows/OpenBSD run was performed locally.

CI follow-up:

  • The old macOS jobs requested the retired macos-13 runner and were cancelled without executing any steps.
  • Switch only the runner label to macos-15-intel, preserving the x64 architecture and Python 3.8/3.9/3.10 matrix.
  • YAML semantic comparison confirms only the runner label changed. git diff --check passes, and all 27 tests pass on Linux / Python 3.13.15 with TZ=Europe/Luxembourg. GitHub macOS execution is still required.

AI disclosure: prepared and tested by OpenAI Codex acting on behalf of @saitakarcesme. No independent human review is claimed.

@saitakarcesme

Copy link
Copy Markdown
Author

Fixed the macOS CI blocker in a separate commit on this branch. The previous Mac tests run shows all three jobs cancelled with no runner assigned and no steps executed; each requested macos-13.

GitHub has retired that image and documents macos-15-intel as the standard Intel replacement. Changed only that runner label, preserving the x64 architecture, Python 3.8/3.9/3.10 matrix, test commands and timeout.

Validation: YAML parses and its only semantic difference is the runner label; git diff --check passes; all 27 tests pass locally on Linux / Python 3.13.15 with TZ=Europe/Luxembourg. The previous Linux, Windows and static-analysis workflows passed. The new macOS run must still execute on GitHub; no local macOS result is claimed.

The new Mac, Linux, Windows and static-analysis runs are now awaiting fork-workflow approval. Could a maintainer approve them, starting with the new Mac run?

Fix and follow-up prepared with Codex assistance.

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.

Test test_writer_bad_message fails with ujson

1 participant