-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[master] Datetime utcnow #66902
base: master
Are you sure you want to change the base?
[master] Datetime utcnow #66902
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you have some pre-commit failures
b2d27e1
to
332538e
Compare
Fixed |
Looks like the test failures are related to your changes in |
What test failures? For the current version I don't see any (there are either green, or pending) |
The test suite tries 3 times... here is the 2nd run: |
332538e
to
5019ab1
Compare
Ah, I see, |
datetime.datetime.utcnow() is deprecated in Python 3.12, and it's recommended to switch to timezone-aware objects, so do this. It also simplifies local time handling, as .astimezone() method can be used instead of calculating timezone_delta manually. Part of saltstack#65604
5019ab1
to
90454cc
Compare
What does this PR do?
This removes some usage of deprecated datetime.datetime.utcnow() and replaces them with timezone-aware objects, while not changing the actual behavior.
What issues does this PR fix or reference?
Partial fix for #65604
This is complementary to #66042
Previous Behavior
Salt logs warnings like:
New Behavior
No warning.
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
Yes
Please review Salt's Contributing Guide for best practices, including the
PR Guidelines.
See GitHub's page on GPG signing for more information about signing commits with GPG.