Use pytest.mark.freeze_time in habitica tests (#156332)

This commit is contained in:
Erik Montnemery
2025-11-11 09:37:17 +01:00
committed by GitHub
parent 0ed342b433
commit 507f54198e
3 changed files with 6 additions and 8 deletions

View File

@@ -3,7 +3,6 @@
from collections.abc import Generator from collections.abc import Generator
from unittest.mock import patch from unittest.mock import patch
from freezegun.api import freeze_time
import pytest import pytest
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion
@@ -33,7 +32,7 @@ async def set_tz(hass: HomeAssistant) -> None:
@pytest.mark.usefixtures("habitica") @pytest.mark.usefixtures("habitica")
@freeze_time("2024-09-20T22:00:00.000Z") @pytest.mark.freeze_time("2024-09-20T22:00:00.000Z")
async def test_calendar_platform( async def test_calendar_platform(
hass: HomeAssistant, hass: HomeAssistant,
config_entry: MockConfigEntry, config_entry: MockConfigEntry,

View File

@@ -7,7 +7,7 @@ from unittest.mock import AsyncMock, patch
from uuid import UUID from uuid import UUID
from aiohttp import ClientError from aiohttp import ClientError
from freezegun.api import FrozenDateTimeFactory, freeze_time from freezegun.api import FrozenDateTimeFactory
from habiticalib import HabiticaGroupMembersResponse from habiticalib import HabiticaGroupMembersResponse
import pytest import pytest
from syrupy.assertion import SnapshotAssertion from syrupy.assertion import SnapshotAssertion
@@ -82,7 +82,7 @@ async def test_notify_platform(
), ),
], ],
) )
@freeze_time("2025-08-13T00:00:00+00:00") @pytest.mark.freeze_time("2025-08-13T00:00:00+00:00")
async def test_send_message( async def test_send_message(
hass: HomeAssistant, hass: HomeAssistant,
config_entry: MockConfigEntry, config_entry: MockConfigEntry,

View File

@@ -7,7 +7,6 @@ from unittest.mock import AsyncMock, patch
from uuid import UUID from uuid import UUID
from aiohttp import ClientError from aiohttp import ClientError
from freezegun.api import freeze_time
from habiticalib import ( from habiticalib import (
Checklist, Checklist,
Direction, Direction,
@@ -1845,7 +1844,7 @@ async def test_create_todo(
], ],
) )
@pytest.mark.usefixtures("mock_uuid4") @pytest.mark.usefixtures("mock_uuid4")
@freeze_time("2025-02-25T22:00:00.000Z") @pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
async def test_update_daily( async def test_update_daily(
hass: HomeAssistant, hass: HomeAssistant,
config_entry: MockConfigEntry, config_entry: MockConfigEntry,
@@ -2023,7 +2022,7 @@ async def test_update_daily(
], ],
) )
@pytest.mark.usefixtures("mock_uuid4") @pytest.mark.usefixtures("mock_uuid4")
@freeze_time("2025-02-25T22:00:00.000Z") @pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
async def test_create_daily( async def test_create_daily(
hass: HomeAssistant, hass: HomeAssistant,
config_entry: MockConfigEntry, config_entry: MockConfigEntry,
@@ -2064,7 +2063,7 @@ async def test_create_daily(
], ],
) )
@pytest.mark.usefixtures("mock_uuid4") @pytest.mark.usefixtures("mock_uuid4")
@freeze_time("2025-02-25T22:00:00.000Z") @pytest.mark.freeze_time("2025-02-25T22:00:00.000Z")
async def test_update_daily_service_validation_errors( async def test_update_daily_service_validation_errors(
hass: HomeAssistant, hass: HomeAssistant,
config_entry: MockConfigEntry, config_entry: MockConfigEntry,