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

Fix deprecation warning for datetime.datetime.utcnow #939

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kfrydel
Copy link

@kfrydel kfrydel commented Nov 3, 2023

This fixes #934.
utcnow function, starting from Python 3.12 is deprecated: https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Thus, this commit turns usages of utcnow() into now(UTC).

Description

The feature or problem addressed by this PR

This addresses the issue described in #934

What your changes do and why you chose this solution

The solution is based on the suggestion from official Python docs:
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Checklist

  • Checked that no other issues or pull requests exist for the same issue/change
  • Added tests covering the new functionality
  • Updated documentation OR the change is too minor to be documented
  • Updated CHANGELOG.md OR changes are insignificant

This fixes IdentityPython#934.
utcnow function, starting from Python 3.12 is deprecated:
https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Thus, this commit turns usages of utcnow() into now(UTC).
@c00kiemon5ter c00kiemon5ter added the next-release should become part of the next release label Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next-release should become part of the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pysaml2 raises DeprecationWarning: datetime.datetime.utcnow() when running tests with pytests on python 3.12
2 participants