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

Modify timestamp generation to remove deprecation warning #2738

Merged
merged 2 commits into from
May 27, 2024

Conversation

JavierUhagon
Copy link
Contributor

@JavierUhagon JavierUhagon commented May 27, 2024

since the merge of #2731 I've been getting a lot of noise in my terminal whenever I'm working on Locust master branch,

/locust/locust/util/date.py:5: 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).

The use of utcfromtimestamp wasn't really adviced since 2019 and it was deprecated in 2023 (relevant info linked below)

python/cpython#81669
python/cpython#103858

I've modified the date.py to use fromtimestamp timezone.utc instead, removing the deprecation warning.

@cyberw cyberw merged commit c6665d4 into locustio:master May 27, 2024
14 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.

2 participants