-
Notifications
You must be signed in to change notification settings - Fork 346
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
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 |
| 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
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.
Resolved.
| @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
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.
Resolved.
|
Switching to draft while review comments are being addressed |
3cd7e3d
tests/oauth2/test__client.py
Outdated
|
|
||
| def test_call_iam_generate_id_token_endpoint(): | ||
| now = _helpers.utcnow() | ||
| now = _helpers.utcnow().astimezone(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.
Tests pass without the changes to tests/oauth2/test__client.py . Let's revert all of the changes in tests/oauth2/test__client.py
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v1.0.1 Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209 <details><summary>google-auth: 2.48.0</summary> ## [2.48.0](v2.47.0...v2.48.0) (2026-01-21) ### Features * honor `NO_GCE_CHECK` environment variable (#1610) ([383c982](383c9827)) * add configurable GCE Metadata Server retries (#1488) ([454b441](454b441b)) * add cryptography as required dependency (#1929) ([52558ae](52558ae2)) * Support the mTLS IAM domain for Certificate based Access (#1938) ([8dcf91a](8dcf91a1)) ### Bug Fixes * resolve circular imports (#1942) ([25c1b06](25c1b064)) * Use `user_verification=preferred` for ReAuth WebAuthn challenge (#1798) ([3f88a24](3f88a240)) * removes `content-header` from AWS IMDS get request (#1934) ([97bfea9](97bfea9e)) * detect correct auth when ADC env var is set but empty (#1374) ([bfc07e1](bfc07e10)) * replace deprecated utcfromtimestamp (#1799) ([e431f20](e431f20c)) </details>
addresses googleapis/google-cloud-python#15145
utcfromtimestamp()in thedatetimelibrary due to deprecation.