-
Notifications
You must be signed in to change notification settings - Fork 345
fix: replace deprecated utcfromtimestamp #1799
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
base: main
Are you sure you want to change the base?
fix: replace deprecated utcfromtimestamp #1799
Conversation
687ac1a to
250f015
Compare
Failing tests due to not stripping tzinfo
|
Hi @andriawang6, I don't think you can simply replace Also see this PR: #1413 |
Linchin
left a comment
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.
I think we need to add unit test for utcfromtimestamp() in tests/test__helpers.py.
|
Removed the Do-Not-Merge label after discussion with @parthea. Further work on this PR appears to have resolved the issue in question as identified by Kevin: #1799 (comment) |
@Linchin |
chalmerlowe
left a comment
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.
LGTM
| assert token == id_token | ||
| # JWT does not store microseconds | ||
| now = now.replace(microsecond=0) | ||
| now = now.replace(microsecond=0).replace(tzinfo=None) |
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.
Following up on offline discussion, tests pass regardless of the changes in tests_async/oauth2/test__client_async.py. Revert this file as it appears to be noise
| @mock.patch( | ||
| "google.auth._helpers.utcnow", | ||
| return_value=datetime.datetime.utcfromtimestamp(0), | ||
| return_value=datetime.datetime.fromtimestamp(0, tz=datetime.timezone.utc), |
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.
use _helpers.utcfromtimestamp . Applies throughout
|
Switching to draft while review comments are being addressed |
addresses #1781
utcfromtimestamp()in thedatetimelibrary due to deprecation.