Skip to content

Accept the Windows-specific error message in the overflow timestamp test - #3039

Closed
afonsojanu wants to merge 1 commit into
marshmallow-code:devfrom
afonsojanu:fix/overflow-timestamp-test-windows-message
Closed

Accept the Windows-specific error message in the overflow timestamp test#3039
afonsojanu wants to merge 1 commit into
marshmallow-code:devfrom
afonsojanu:fix/overflow-timestamp-test-windows-message

Conversation

@afonsojanu

Copy link
Copy Markdown

Fixes #2999

test_from_timestamp_with_overflow_value only checked for the error message datetime.fromtimestamp() produces on Linux and macOS for this particular overflow value, a plain ValueError about the year being out of range. On Windows, the same call raises OSError instead, which from_timestamp() already catches and re-raises as ValueError("Error converting value to datetime"), a perfectly valid outcome that the test's regex just never accounted for. That's exactly the failure shown in the linked issue's Windows CI log.

Broadened the match to also accept that message. Confirmed the existing behavior on my own machine still passes as before (this platform hits the ValueError branch, not OSError), and separately simulated the OSError branch by monkeypatching datetime.fromtimestamp to confirm the new alternative in the regex matches the literal message from_timestamp() produces there, since I don't have a Windows machine to reproduce the CI failure directly.

Full test suite (1190 tests) passes, ruff check and ruff format both clean at the pinned v0.16.1.

from_timestamp() wraps any OSError from datetime.fromtimestamp() into
a ValueError with its own fixed message, "Error converting value to
datetime". On Linux and macOS this particular overflow value never
takes that path since CPython there raises a plain ValueError about
the resulting year being out of range, so the test's regex never had
to account for the other branch. On Windows, fromtimestamp() raises
OSError for the same input, which lands on that wrapped message
instead, and the old regex didn't match it, failing CI there on every
platform-matrix build.

Broadened the match to also accept that message, since it's exactly
what from_timestamp()'s own exception handling produces here and
means the same thing as the other two: the value was rejected because
it was out of range.
@lafrech lafrech closed this Aug 31, 2026
@afonsojanu
afonsojanu deleted the fix/overflow-timestamp-test-windows-message branch August 31, 2026 19:43
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_from_timestamp_with_overflow_value test failing on Windows because of message mismatch

2 participants