Skip to content

Commit 02ff5de

Browse files
authored
Use pytest.mark.freeze_time in ntfy tests (home-assistant#156336)
1 parent 5cd5d48 commit 02ff5de

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

tests/components/ntfy/snapshots/test_event.ambr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
'event_types': list([
5353
'Title: Hello',
5454
]),
55-
'expires': datetime.datetime(2025, 3, 29, 5, 58, 46, tzinfo=datetime.timezone.utc),
55+
'expires': HAFakeDatetime(2025, 3, 29, 5, 58, 46, tzinfo=datetime.timezone.utc),
5656
'friendly_name': 'mytopic',
5757
'icon': 'https://example.com/icon.png',
5858
'id': 'h6Y2hKA5sy0U',
@@ -61,7 +61,7 @@
6161
'tags': list([
6262
'octopus',
6363
]),
64-
'time': datetime.datetime(2025, 3, 28, 17, 58, 46, tzinfo=datetime.timezone.utc),
64+
'time': HAFakeDatetime(2025, 3, 28, 17, 58, 46, tzinfo=datetime.timezone.utc),
6565
'title': 'Title',
6666
'topic': 'mytopic',
6767
}),

tests/components/ntfy/test_event.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
NtfyTimeoutError,
1414
NtfyUnauthorizedAuthenticationError,
1515
)
16-
from freezegun.api import FrozenDateTimeFactory, freeze_time
16+
from freezegun.api import FrozenDateTimeFactory
1717
import pytest
1818
from syrupy.assertion import SnapshotAssertion
1919

@@ -44,7 +44,7 @@ async def event_only() -> AsyncGenerator[None]:
4444

4545

4646
@pytest.mark.usefixtures("mock_aiontfy")
47-
@freeze_time("2025-09-03T22:00:00.000Z")
47+
@pytest.mark.freeze_time("2025-09-03T22:00:00.000Z")
4848
async def test_event_platform(
4949
hass: HomeAssistant,
5050
config_entry: MockConfigEntry,

tests/components/ntfy/test_notify.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
NtfyHTTPError,
1010
NtfyUnauthorizedAuthenticationError,
1111
)
12-
from freezegun.api import freeze_time
1312
import pytest
1413
from syrupy.assertion import SnapshotAssertion
1514

@@ -57,7 +56,7 @@ async def test_notify_platform(
5756
await snapshot_platform(hass, entity_registry, snapshot, config_entry.entry_id)
5857

5958

60-
@freeze_time("2025-01-09T12:00:00+00:00")
59+
@pytest.mark.freeze_time("2025-01-09T12:00:00+00:00")
6160
async def test_send_message(
6261
hass: HomeAssistant,
6362
config_entry: MockConfigEntry,

0 commit comments

Comments
 (0)