8000 chore(tests): fix timezone test by daniel-sanche · Pull Request #1069 · googleapis/python-firestore · GitHub
[go: up one dir, main page]

Skip to content

chore(tests): fix timezone test #1069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2025
Merged

chore(tests): fix timezone test #1069

merged 1 commit into from
Jun 18, 2025

Conversation

daniel-sanche
Copy link
Contributor

test_aggregation_query_get_stream_iterator_read_time_different_timezones currently fails when run in non-utc timezones

This section will build a different datetime value depending on the local machine's clock, since it's all based on a naive timestamp:

read_time = datetime(1970, 1, 1, 0, 30)
if timezone is not None:
    read_time = read_time.astimezone(timezone)

But the assertion assumes that the resulting timestamp value will be a fixed time in utc:

expected_timestamp = Timestamp(seconds=1800)

To fix this, I changed it to use datetime.fromtimestamp(1800, tz=custom_timezone)

@daniel-sanche daniel-sanche requested review from a team as code owners June 17, 2025 23:45
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: firestore Issues related to the googleapis/python-firestore API. labels Jun 17, 2025
@gkevinzheng gkevinzheng merged commit e6fd577 into main Jun 18, 2025
24 checks passed
@gkevinzheng gkevinzheng deleted the fix_timestamp_test branch June 18, 2025 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/python-firestore API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0