Skip to content

Commit e9011de

Browse files
committed
test(calendar): TZ-aware datetime in deletable_event_uid fixture
Carry-over from PR #1415 — use datetime.now(UTC) instead of naive datetime.now() in the fixture so ISO 8601 strings stay unambiguous when the test runner and HA instance are in different timezones. Matches the convention in tests/src/e2e/workflows/core/test_history.py. Pre-existing naive datetime.now() calls elsewhere in this file are unchanged — format-debt tracked broadly at #1318.
1 parent c51b6d8 commit e9011de

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

tests/src/e2e/workflows/calendar/test_calendar.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
import logging
1515
import uuid
16-
from datetime import datetime, timedelta
16+
from datetime import UTC, datetime, timedelta
1717

1818
import pytest
1919

@@ -328,7 +328,10 @@ async def deletable_event_uid(self, mcp_client):
328328
pytest.skip("No writable calendar found for testing")
329329

330330
summary = f"E2E Deletable Test Event {uuid.uuid4().hex[:8]}"
331-
now = datetime.now()
331+
# TZ-aware so ISO 8601 strings stay unambiguous when the test runner
332+
# and the HA instance are in different timezones (matches the
333+
# convention in tests/src/e2e/workflows/core/test_history.py).
334+
now = datetime.now(UTC)
332335
start = (now + timedelta(days=1)).replace(
333336
hour=14, minute=0, second=0, microsecond=0
334337
)

0 commit comments

Comments
 (0)