Skip to content

Commit 2936c75

Browse files
committed
Fixed UTC-related issue in tests
1 parent cfaa6be commit 2936c75

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

src/app/endpoints/query.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,7 @@ async def query_endpoint_handler(
237237
quota_limiters=configuration.quota_limiters, user_id=user_id
238238
)
239239

240-
completed_at = datetime.datetime.now(datetime.UTC).strftime(
241-
"%Y-%m-%dT%H:%M:%SZ"
242-
)
240+
completed_at = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
243241
conversation_id = normalize_conversation_id(responses_params.conversation)
244242

245243
logger.info("Storing query results")

tests/unit/app/endpoints/test_conversations_v2.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
"""Unit tests for the /conversations REST API endpoints."""
44

5-
from datetime import datetime, timezone
5+
from datetime import datetime, UTC
66
from typing import Any, cast
77

88
import pytest
@@ -361,9 +361,7 @@ async def test_successful_retrieval(
361361
mocker.patch("app.endpoints.conversations_v2.configuration", mock_configuration)
362362

363363
timestamp_str = "2024-01-01T00:00:00Z"
364-
timestamp_dt = datetime.fromisoformat(timestamp_str).replace(
365-
tzinfo=timezone.utc
366-
)
364+
timestamp_dt = datetime.fromisoformat(timestamp_str).replace(tzinfo=UTC)
367365
timestamp = timestamp_dt.timestamp()
368366

369367
mock_configuration.conversation_cache.list.return_value = [

0 commit comments

Comments
 (0)