Skip to content

Commit 507f541

Browse files
authored
Use pytest.mark.freeze_time in habitica tests (home-assistant#156332)
1 parent 0ed342b commit 507f541

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

tests/components/habitica/test_calendar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from collections.abc import Generator
44
from unittest.mock import patch
55

6-
from freezegun.api import freeze_time
76
import pytest
87
from syrupy.assertion import SnapshotAssertion
98

@@ -33,7 +32,7 @@ async def set_tz(hass: HomeAssistant) -> None:
3332

3433

3534
@pytest.mark.usefixtures("habitica")
36-
@freeze_time("2024-09-20T22:00:00.000Z")
35+
@pytest.mark.freeze_time("2024-09-20T22:00:00.000Z")
3736
async def test_calendar_platform(
3837
hass: HomeAssistant,
3938
config_entry: MockConfigEntry,

tests/components/habitica/test_notify.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from uuid import UUID
88

99
from aiohttp import ClientError
10-
from freezegun.api import FrozenDateTimeFactory, freeze_time
10+
from freezegun.api import FrozenDateTimeFactory
1111
from habiticalib import HabiticaGroupMembersResponse
1212
import pytest
1313
from syrupy.assertion import SnapshotAssertion
@@ -82,7 +82,7 @@ async def test_notify_platform(
8282
),
8383
],
8484
)
85-
@freeze_time("2025-08-13T00:00:00+00:00")
85+
@pytest.mark.freeze_time("2025-08-13T00:00:00+00:00")
8686
async def test_send_message(
8787
hass: HomeAssistant,
8888
config_entry: MockConfigEntry,

tests/components/habitica/test_services.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from uuid import UUID
88

99
from aiohttp import ClientError
10-
from freezegun.api import freeze_time
1110
from habiticalib import (
1211
Checklist,
1312
Direction,
@@ -1845,7 +1844,7 @@ async def test_create_todo(
18451844
],
18461845
)
18471846
@pytest.mark.usefixtures("mock_uuid4")
1848-
@freeze_time("2025-02-25T22:00:00.000Z")
1847+
@pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
18491848
async def test_update_daily(
18501849
hass: HomeAssistant,
18511850
config_entry: MockConfigEntry,
@@ -2023,7 +2022,7 @@ async def test_update_daily(
20232022
],
20242023
)
20252024
@pytest.mark.usefixtures("mock_uuid4")
2026-
@freeze_time("2025-02-25T22:00:00.000Z")
2025+
@pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
20272026
async def test_create_daily(
20282027
hass: HomeAssistant,
20292028
config_entry: MockConfigEntry,
@@ -2064,7 +2063,7 @@ async def test_create_daily(
20642063
],
20652064
)
20662065
@pytest.mark.usefixtures("mock_uuid4")
2067-
@freeze_time("2025-02-25T22:00:00.000Z")
2066+
@pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
20682067
async def test_update_daily_service_validation_errors(
20692068
hass: HomeAssistant,
20702069
config_entry: MockConfigEntry,

0 commit comments

Comments
 (0)