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

datetime.utcnow() deprecated in Python 3.12 #240

Closed
The-Compiler opened this issue May 31, 2023 · 0 comments · Fixed by #253
Closed

datetime.utcnow() deprecated in Python 3.12 #240

The-Compiler opened this issue May 31, 2023 · 0 comments · Fixed by #253

Comments

@The-Compiler
Copy link
Contributor

datetime.utcnow() seems to be deprecated in Python 3.12, which with -Werror leads to:

  [...]
  File ".../python3.12/site-packages/pytest_benchmark/plugin.py", line 213, in pytest_addoption
    tag = get_tag()
          ^^^^^^^^^
  File ".../python3.12/site-packages/pytest_benchmark/utils.py", line 75, in get_tag
    parts = [info['id'], get_current_time()]
                         ^^^^^^^^^^^^^^^^^^
  File ".../python3.12/site-packages/pytest_benchmark/utils.py", line 201, in get_current_time
    return datetime.utcnow().strftime("%Y%m%d_%H%M%S")
           ^^^^^^^^^^^^^^^^^
DeprecationWarning: datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.now(datetime.UTC).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant