Skip to content
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

Scripts: update buildnumber to use timezone-aware datetime #5971

Merged
merged 1 commit into from
May 8, 2024

Conversation

onetechnical
Copy link
Contributor

Summary

Running make will get this deprecation warning for newer versions of python:

./scripts/buildnumber.py:13: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
  d1 = datetime.utcnow()

This is because utcnow is timezone-aware, and the earlier datetime call is naive. To make this consistent, we just mark all to UTC, to make consistent with the comment for setting the epoch.

Test Plan

Verified that ./scripts/buildnumber.py returned output without deprecation warnings.

Verified on 3.12.2 and 3.8.10 (version shipped with Ubuntu 20.04).

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.72%. Comparing base (0e7087b) to head (0b5e635).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5971      +/-   ##
==========================================
- Coverage   55.73%   55.72%   -0.01%     
==========================================
  Files         490      490              
  Lines       68125    68125              
==========================================
- Hits        37967    37963       -4     
- Misses      27586    27589       +3     
- Partials     2572     2573       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@onetechnical onetechnical merged commit c4072a6 into master May 8, 2024
21 checks passed
@onetechnical onetechnical deleted the buildnumber-python-deprecation branch May 8, 2024 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants