diff --git a/tests/handlers/api_tokens_test.py b/tests/handlers/api_tokens_test.py index fb84eaef..31c0bb18 100644 --- a/tests/handlers/api_tokens_test.py +++ b/tests/handlers/api_tokens_test.py @@ -943,7 +943,7 @@ async def test_create_admin( # Intentionally pass in a datetime with microseconds. They should be # stripped off so that the expiration is rounded to seconds, which we will # check when examining the log message. - now = current_datetime(microseconds=True) + now = datetime.now(tz=UTC) expires = now + timedelta(days=2) caplog.clear() r = await client.post( diff --git a/tests/support/logging.py b/tests/support/logging.py index 8d7ee461..e7f2407f 100644 --- a/tests/support/logging.py +++ b/tests/support/logging.py @@ -7,7 +7,6 @@ from typing import Any import pytest -from safir.datetime import current_datetime __all__ = ["parse_log"] @@ -33,7 +32,7 @@ def parse_log( List of parsed JSON dictionaries with the common log attributes removed (after validation). """ - now = current_datetime(microseconds=True) + now = datetime.now(tz=UTC) messages = [] for log_tuple in caplog.record_tuples: