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 DeprecationWarning with newer Python versions #41

Merged
merged 1 commit into from
Mar 10, 2024
Merged

Fix DeprecationWarning with newer Python versions #41

merged 1 commit into from
Mar 10, 2024

Conversation

lcosmin
Copy link
Contributor

@lcosmin lcosmin commented Mar 7, 2024

Using pytest-logger 1.1.0 with Python 3.12 results in the following DeprecationWarning:

/Users/xxx/.venv/lib/python3.12/site-packages/pytest_logger/plugin.py:310: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
dt = datetime.datetime.utcfromtimestamp(ct)

This commit replaces utcfromtimestamp with fromtimestamp(..., tz=datetime.timezone.utc)

Using pytest-logger 1.1.0 with Python 3.12 results in the following
DeprecationWarning:

  /Users/xxx/.venv/lib/python3.12/site-packages/pytest_logger/plugin.py:310: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
    dt = datetime.datetime.utcfromtimestamp(ct)
@coveralls
Copy link

Coverage Status

coverage: 98.662%. remained the same
when pulling 53628f2 on lcosmin:master
into 322b8b9 on aurzenligl:master.

@aurzenligl
Copy link
Owner

Thanks for the PR! I'm pulling this and releasing as patch.

@aurzenligl aurzenligl merged commit 19c1dfb into aurzenligl:master Mar 10, 2024
12 checks passed
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 this pull request may close these issues.

3 participants