diff --git a/tests/test_collectors.py b/tests/test_collectors.py index 570507a..c95b78c 100644 --- a/tests/test_collectors.py +++ b/tests/test_collectors.py @@ -1,6 +1,6 @@ import json import time -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from typing import List from unittest.mock import Mock @@ -359,7 +359,8 @@ def test_collect(self, worker_1): redis.hgetall.return_value = { # Simulate a job that was enqueued 1 minute ago b"enqueued_at": rq_utils.utcformat( - datetime.utcnow() - timedelta(minutes=1) + datetime.now(tz=timezone.utc).replace(tzinfo=None) + - timedelta(minutes=1) ).encode(), # Job origin has to match the queue name b"origin": b"foo", @@ -381,7 +382,8 @@ def test_collect_with_busy_job_tracking(self, worker_1, monkeypatch): redis.hgetall.return_value = { # Simulate a job that was enqueued 1 minute ago b"enqueued_at": rq_utils.utcformat( - datetime.utcnow() - timedelta(minutes=1) + datetime.now(tz=timezone.utc).replace(tzinfo=None) + - timedelta(minutes=1) ).encode(), # Job origin has to match the queue name b"origin": b"foo",