Skip to content

Commit

Permalink
chore(tests): fix tz warning
Browse files Browse the repository at this point in the history
Running the tests locally, I get:

```
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC
```

The recommended upgrade is to use `datetime.now(timezone.utc)` which is
what is done here.
  • Loading branch information
Kyle-Verhoog committed Nov 21, 2024
1 parent d792c3d commit 50ee5fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ def _should_skip(condition=None, until: int = None):
until = dt.datetime(3000, 1, 1)
else:
until = dt.datetime.fromtimestamp(until)
if until and dt.datetime.utcnow() < until.replace(tzinfo=None):
if until and datetime.now(timezone.utc) < until.replace(tzinfo=None):
return True
if condition is not None and not condition:
return False
Expand Down

0 comments on commit 50ee5fc

Please sign in to comment.