Skip to content

Commit

Permalink
Merge branch 'mr/ramonat/replace-utcnow' into 'master'
Browse files Browse the repository at this point in the history
Avoid use of utcnow() which is deprecated

See merge request it/e3-core!79
  • Loading branch information
enzbang committed Dec 13, 2024
2 parents a6a22b5 + 77330e7 commit 6e9e3a5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/tests_e3/log/main_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import datetime
from datetime import datetime as dt, timezone as tz
import sys
import json
import dateutil.parser
Expand Down Expand Up @@ -30,9 +30,8 @@ def test_log():
log_datetime, _, _ = line.partition(": ")

# Parse it and verify that it is it in GMT
assert (
datetime.datetime.utcnow() - dateutil.parser.parse(log_datetime)
).seconds < 10
parsed_log_datetime = dateutil.parser.parse(log_datetime).replace(tzinfo=tz.utc)
assert (dt.now(tz=tz.utc) - parsed_log_datetime).seconds < 10


def test_json_log():
Expand Down

0 comments on commit 6e9e3a5

Please sign in to comment.