Improve type hints in calendar tests (#121654)
parent
8b0f28e7f4
commit
5d809f88ba
|
@ -23,7 +23,7 @@ from tests.typing import ClientSessionGenerator, WebSocketGenerator
|
|||
|
||||
|
||||
@pytest.fixture(name="frozen_time")
|
||||
def mock_frozen_time() -> None:
|
||||
def mock_frozen_time() -> str | None:
|
||||
"""Fixture to set a frozen time used in tests.
|
||||
|
||||
This is needed so that it can run before other fixtures.
|
||||
|
@ -32,7 +32,7 @@ def mock_frozen_time() -> None:
|
|||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_set_frozen_time(frozen_time: Any) -> Generator[None]:
|
||||
def mock_set_frozen_time(frozen_time: str | None) -> Generator[None]:
|
||||
"""Fixture to freeze time that also can work for other fixtures."""
|
||||
if not frozen_time:
|
||||
yield
|
||||
|
@ -44,9 +44,9 @@ def mock_set_frozen_time(frozen_time: Any) -> Generator[None]:
|
|||
@pytest.fixture(name="setup_platform", autouse=True)
|
||||
async def mock_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
set_time_zone: Any,
|
||||
frozen_time: Any,
|
||||
mock_setup_integration: Any,
|
||||
set_time_zone: None,
|
||||
frozen_time: str | None,
|
||||
mock_setup_integration: None,
|
||||
config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Fixture to setup platforms used in the test and fixtures are set up in the right order."""
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
"""The tests for calendar recorder."""
|
||||
|
||||
from datetime import timedelta
|
||||
from typing import Any
|
||||
|
||||
import pytest
|
||||
|
||||
|
@ -19,7 +18,7 @@ from tests.components.recorder.common import async_wait_recording_done
|
|||
async def mock_setup_dependencies(
|
||||
recorder_mock: Recorder,
|
||||
hass: HomeAssistant,
|
||||
set_time_zone: Any,
|
||||
set_time_zone: None,
|
||||
mock_setup_integration: None,
|
||||
config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
|
|
|
@ -84,9 +84,7 @@ class FakeSchedule:
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def fake_schedule(
|
||||
hass: HomeAssistant, freezer: FrozenDateTimeFactory
|
||||
) -> Generator[FakeSchedule]:
|
||||
def fake_schedule(hass: HomeAssistant, freezer: FrozenDateTimeFactory) -> FakeSchedule:
|
||||
"""Fixture that tests can use to make fake events."""
|
||||
|
||||
# Setup start time for all tests
|
||||
|
@ -104,7 +102,7 @@ def mock_test_entity(test_entities: list[MockCalendarEntity]) -> MockCalendarEnt
|
|||
@pytest.fixture(name="setup_platform", autouse=True)
|
||||
async def mock_setup_platform(
|
||||
hass: HomeAssistant,
|
||||
mock_setup_integration: Any,
|
||||
mock_setup_integration: None,
|
||||
config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Fixture to setup platforms used in the test."""
|
||||
|
|
Loading…
Reference in New Issue