mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Improve type hints in tests (q-z) (#118381)
This commit is contained in:
parent
242ee04642
commit
1317837986
@ -1262,7 +1262,7 @@ async def test_auto_purge_disabled(
|
|||||||
async def test_auto_statistics(
|
async def test_auto_statistics(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
setup_recorder: None,
|
setup_recorder: None,
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test periodic statistics scheduling."""
|
"""Test periodic statistics scheduling."""
|
||||||
timezone = "Europe/Copenhagen"
|
timezone = "Europe/Copenhagen"
|
||||||
|
@ -721,7 +721,7 @@ async def test_no_issue_for_mariadb_with_MDEV_25020(
|
|||||||
|
|
||||||
|
|
||||||
async def test_basic_sanity_check(
|
async def test_basic_sanity_check(
|
||||||
hass: HomeAssistant, setup_recorder: None, recorder_db_url
|
hass: HomeAssistant, setup_recorder: None, recorder_db_url: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the basic sanity checks with a missing table."""
|
"""Test the basic sanity checks with a missing table."""
|
||||||
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
||||||
@ -742,7 +742,7 @@ async def test_combined_checks(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
setup_recorder: None,
|
setup_recorder: None,
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
recorder_db_url,
|
recorder_db_url: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run Checks on the open database."""
|
"""Run Checks on the open database."""
|
||||||
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
||||||
@ -831,7 +831,7 @@ async def test_end_incomplete_runs(
|
|||||||
|
|
||||||
|
|
||||||
async def test_periodic_db_cleanups(
|
async def test_periodic_db_cleanups(
|
||||||
hass: HomeAssistant, setup_recorder: None, recorder_db_url
|
hass: HomeAssistant, setup_recorder: None, recorder_db_url: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test periodic db cleanups."""
|
"""Test periodic db cleanups."""
|
||||||
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
if recorder_db_url.startswith(("mysql://", "postgresql://")):
|
||||||
|
@ -432,7 +432,9 @@ async def test_step_unauth(
|
|||||||
|
|
||||||
@pytest.mark.freeze_time("2022-07-19 07:53:05")
|
@pytest.mark.freeze_time("2022-07-19 07:53:05")
|
||||||
async def test_list_issues(
|
async def test_list_issues(
|
||||||
hass: HomeAssistant, hass_storage: dict[str, Any], hass_ws_client
|
hass: HomeAssistant,
|
||||||
|
hass_storage: dict[str, Any],
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test we can list issues."""
|
"""Test we can list issues."""
|
||||||
|
|
||||||
@ -581,7 +583,9 @@ async def test_fix_issue_aborted(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.freeze_time("2022-07-19 07:53:05")
|
@pytest.mark.freeze_time("2022-07-19 07:53:05")
|
||||||
async def test_get_issue_data(hass: HomeAssistant, hass_ws_client) -> None:
|
async def test_get_issue_data(
|
||||||
|
hass: HomeAssistant, hass_ws_client: WebSocketGenerator
|
||||||
|
) -> None:
|
||||||
"""Test we can get issue data."""
|
"""Test we can get issue data."""
|
||||||
|
|
||||||
assert await async_setup_component(hass, DOMAIN, {})
|
assert await async_setup_component(hass, DOMAIN, {})
|
||||||
|
@ -6,6 +6,7 @@ from collections.abc import Callable, Coroutine
|
|||||||
from typing import Any
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components.schedule import STORAGE_VERSION, STORAGE_VERSION_MINOR
|
from homeassistant.components.schedule import STORAGE_VERSION, STORAGE_VERSION_MINOR
|
||||||
@ -181,7 +182,7 @@ async def test_events_one_day(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test events only during one day of the week."""
|
"""Test events only during one day of the week."""
|
||||||
freezer.move_to("2022-08-30 13:20:00-07:00")
|
freezer.move_to("2022-08-30 13:20:00-07:00")
|
||||||
@ -225,7 +226,7 @@ async def test_adjacent_cross_midnight(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test adjacent events don't toggle on->off->on."""
|
"""Test adjacent events don't toggle on->off->on."""
|
||||||
freezer.move_to("2022-08-30 13:20:00-07:00")
|
freezer.move_to("2022-08-30 13:20:00-07:00")
|
||||||
@ -286,7 +287,7 @@ async def test_adjacent_within_day(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test adjacent events don't toggle on->off->on."""
|
"""Test adjacent events don't toggle on->off->on."""
|
||||||
freezer.move_to("2022-08-30 13:20:00-07:00")
|
freezer.move_to("2022-08-30 13:20:00-07:00")
|
||||||
@ -349,7 +350,7 @@ async def test_non_adjacent_within_day(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test adjacent events don't toggle on->off->on."""
|
"""Test adjacent events don't toggle on->off->on."""
|
||||||
freezer.move_to("2022-08-30 13:20:00-07:00")
|
freezer.move_to("2022-08-30 13:20:00-07:00")
|
||||||
@ -429,7 +430,7 @@ async def test_to_midnight(
|
|||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
schedule: list[dict[str, str]],
|
schedule: list[dict[str, str]],
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test time range allow to 24:00."""
|
"""Test time range allow to 24:00."""
|
||||||
freezer.move_to("2022-08-30 13:20:00-07:00")
|
freezer.move_to("2022-08-30 13:20:00-07:00")
|
||||||
@ -516,7 +517,7 @@ async def test_load(
|
|||||||
async def test_schedule_updates(
|
async def test_schedule_updates(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test the schedule updates when time changes."""
|
"""Test the schedule updates when time changes."""
|
||||||
freezer.move_to("2022-08-10 20:10:00-07:00")
|
freezer.move_to("2022-08-10 20:10:00-07:00")
|
||||||
@ -678,7 +679,7 @@ async def test_ws_create(
|
|||||||
hass_ws_client: WebSocketGenerator,
|
hass_ws_client: WebSocketGenerator,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
schedule_setup: Callable[..., Coroutine[Any, Any, bool]],
|
||||||
freezer,
|
freezer: FrozenDateTimeFactory,
|
||||||
to: str,
|
to: str,
|
||||||
next_event: str,
|
next_event: str,
|
||||||
saved_to: str,
|
saved_to: str,
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""Tests for the tag component."""
|
"""Tests for the tag component."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -18,7 +20,7 @@ from tests.typing import WebSocketGenerator
|
|||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def storage_setup_named_tag(
|
def storage_setup_named_tag(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage,
|
hass_storage: dict[str, Any],
|
||||||
):
|
):
|
||||||
"""Storage setup for test case of named tags."""
|
"""Storage setup for test case of named tags."""
|
||||||
|
|
||||||
@ -76,7 +78,7 @@ async def test_named_tag_scanned_event(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def storage_setup_unnamed_tag(hass: HomeAssistant, hass_storage):
|
def storage_setup_unnamed_tag(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||||
"""Storage setup for test case of unnamed tags."""
|
"""Storage setup for test case of unnamed tags."""
|
||||||
|
|
||||||
async def _storage(items=None):
|
async def _storage(items=None):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""Tests for the tag component."""
|
"""Tests for the tag component."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
import pytest
|
import pytest
|
||||||
@ -20,7 +21,7 @@ from tests.typing import WebSocketGenerator
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def storage_setup(hass: HomeAssistant, hass_storage):
|
def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||||
"""Storage setup."""
|
"""Storage setup."""
|
||||||
|
|
||||||
async def _storage(items=None):
|
async def _storage(items=None):
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
"""Tests for tag triggers."""
|
"""Tests for tag triggers."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components import automation
|
from homeassistant.components import automation
|
||||||
@ -18,7 +20,7 @@ def stub_blueprint_populate_autouse(stub_blueprint_populate: None) -> None:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def tag_setup(hass: HomeAssistant, hass_storage):
|
def tag_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||||
"""Tag setup."""
|
"""Tag setup."""
|
||||||
|
|
||||||
async def _storage(items=None):
|
async def _storage(items=None):
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -59,7 +60,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def storage_setup(hass: HomeAssistant, hass_storage):
|
def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||||
"""Storage setup."""
|
"""Storage setup."""
|
||||||
|
|
||||||
async def _storage(items=None, config=None):
|
async def _storage(items=None, config=None):
|
||||||
|
@ -658,7 +658,9 @@ async def test_dst1(
|
|||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
async def test_dst2(hass, freezer, hass_tz_info):
|
async def test_dst2(
|
||||||
|
hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info
|
||||||
|
) -> None:
|
||||||
"""Test DST when there's a time switch in the East."""
|
"""Test DST when there's a time switch in the East."""
|
||||||
hass.config.time_zone = "CET"
|
hass.config.time_zone = "CET"
|
||||||
dt_util.set_default_time_zone(dt_util.get_time_zone("CET"))
|
dt_util.set_default_time_zone(dt_util.get_time_zone("CET"))
|
||||||
@ -684,7 +686,9 @@ async def test_dst2(hass, freezer, hass_tz_info):
|
|||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
async def test_dst3(hass, freezer, hass_tz_info):
|
async def test_dst3(
|
||||||
|
hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info
|
||||||
|
) -> None:
|
||||||
"""Test DST when there's a time switch forward in the West."""
|
"""Test DST when there's a time switch forward in the West."""
|
||||||
hass.config.time_zone = "US/Pacific"
|
hass.config.time_zone = "US/Pacific"
|
||||||
dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific"))
|
dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific"))
|
||||||
@ -712,7 +716,9 @@ async def test_dst3(hass, freezer, hass_tz_info):
|
|||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
|
|
||||||
async def test_dst4(hass, freezer, hass_tz_info):
|
async def test_dst4(
|
||||||
|
hass: HomeAssistant, freezer: FrozenDateTimeFactory, hass_tz_info
|
||||||
|
) -> None:
|
||||||
"""Test DST when there's a time switch backward in the West."""
|
"""Test DST when there's a time switch backward in the West."""
|
||||||
hass.config.time_zone = "US/Pacific"
|
hass.config.time_zone = "US/Pacific"
|
||||||
dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific"))
|
dt_util.set_default_time_zone(dt_util.get_time_zone("US/Pacific"))
|
||||||
|
@ -122,7 +122,7 @@ async def _assert_contexts(client, next_id, contexts, domain=None, item_id=None)
|
|||||||
async def test_get_trace(
|
async def test_get_trace(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
hass_ws_client,
|
hass_ws_client: WebSocketGenerator,
|
||||||
domain,
|
domain,
|
||||||
prefix,
|
prefix,
|
||||||
extra_trace_keys,
|
extra_trace_keys,
|
||||||
@ -425,7 +425,10 @@ async def test_get_trace(
|
|||||||
|
|
||||||
@pytest.mark.parametrize("domain", ["automation", "script"])
|
@pytest.mark.parametrize("domain", ["automation", "script"])
|
||||||
async def test_restore_traces(
|
async def test_restore_traces(
|
||||||
hass: HomeAssistant, hass_storage: dict[str, Any], hass_ws_client, domain
|
hass: HomeAssistant,
|
||||||
|
hass_storage: dict[str, Any],
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
domain: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test restored traces."""
|
"""Test restored traces."""
|
||||||
hass.set_state(CoreState.not_running)
|
hass.set_state(CoreState.not_running)
|
||||||
@ -595,9 +598,9 @@ async def test_trace_overflow(
|
|||||||
async def test_restore_traces_overflow(
|
async def test_restore_traces_overflow(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
hass_ws_client,
|
hass_ws_client: WebSocketGenerator,
|
||||||
domain,
|
domain: str,
|
||||||
num_restored_moon_traces,
|
num_restored_moon_traces: int,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test restored traces are evicted first."""
|
"""Test restored traces are evicted first."""
|
||||||
hass.set_state(CoreState.not_running)
|
hass.set_state(CoreState.not_running)
|
||||||
@ -675,10 +678,10 @@ async def test_restore_traces_overflow(
|
|||||||
async def test_restore_traces_late_overflow(
|
async def test_restore_traces_late_overflow(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
hass_storage: dict[str, Any],
|
hass_storage: dict[str, Any],
|
||||||
hass_ws_client,
|
hass_ws_client: WebSocketGenerator,
|
||||||
domain,
|
domain: str,
|
||||||
num_restored_moon_traces,
|
num_restored_moon_traces: int,
|
||||||
restored_run_id,
|
restored_run_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test restored traces are evicted first."""
|
"""Test restored traces are evicted first."""
|
||||||
hass.set_state(CoreState.not_running)
|
hass.set_state(CoreState.not_running)
|
||||||
|
@ -23,8 +23,11 @@ from tests.typing import WebSocketGenerator
|
|||||||
|
|
||||||
|
|
||||||
async def test_deprecated_entity(
|
async def test_deprecated_entity(
|
||||||
hass: HomeAssistant, ufp: MockUFPFixture, hass_ws_client, doorbell: Camera
|
hass: HomeAssistant,
|
||||||
):
|
ufp: MockUFPFixture,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
doorbell: Camera,
|
||||||
|
) -> None:
|
||||||
"""Test Deprecate entity repair does not exist by default (new installs)."""
|
"""Test Deprecate entity repair does not exist by default (new installs)."""
|
||||||
|
|
||||||
await init_entry(hass, ufp, [doorbell])
|
await init_entry(hass, ufp, [doorbell])
|
||||||
@ -47,9 +50,9 @@ async def test_deprecated_entity_no_automations(
|
|||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
entity_registry: er.EntityRegistry,
|
entity_registry: er.EntityRegistry,
|
||||||
ufp: MockUFPFixture,
|
ufp: MockUFPFixture,
|
||||||
hass_ws_client,
|
hass_ws_client: WebSocketGenerator,
|
||||||
doorbell: Camera,
|
doorbell: Camera,
|
||||||
):
|
) -> None:
|
||||||
"""Test Deprecate entity repair exists for existing installs."""
|
"""Test Deprecate entity repair exists for existing installs."""
|
||||||
entity_registry.async_get_or_create(
|
entity_registry.async_get_or_create(
|
||||||
Platform.SWITCH,
|
Platform.SWITCH,
|
||||||
|
@ -110,7 +110,9 @@ async def test_options(hass: HomeAssistant) -> None:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def test_already_configured(hass: HomeAssistant, requests_mock) -> None:
|
async def test_already_configured(
|
||||||
|
hass: HomeAssistant, requests_mock: requests_mock.Mocker
|
||||||
|
) -> None:
|
||||||
"""Test duplicate entry aborts and updates data."""
|
"""Test duplicate entry aborts and updates data."""
|
||||||
|
|
||||||
config_entry = MockConfigEntry(
|
config_entry = MockConfigEntry(
|
||||||
|
@ -519,7 +519,7 @@ def network_backup() -> zigpy.backups.NetworkBackup:
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def core_rs(hass_storage):
|
def core_rs(hass_storage: dict[str, Any]):
|
||||||
"""Core.restore_state fixture."""
|
"""Core.restore_state fixture."""
|
||||||
|
|
||||||
def _storage(entity_id, state, attributes={}):
|
def _storage(entity_id, state, attributes={}):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Test ZHA select entities."""
|
"""Test ZHA select entities."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import call, patch
|
from unittest.mock import call, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -90,7 +91,7 @@ async def light(hass, zigpy_device_mock):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def core_rs(hass_storage):
|
def core_rs(hass_storage: dict[str, Any]):
|
||||||
"""Core.restore_state fixture."""
|
"""Core.restore_state fixture."""
|
||||||
|
|
||||||
def _storage(entity_id, state):
|
def _storage(entity_id, state):
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import math
|
import math
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -646,7 +647,7 @@ def hass_ms(hass: HomeAssistant):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def core_rs(hass_storage):
|
def core_rs(hass_storage: dict[str, Any]):
|
||||||
"""Core.restore_state fixture."""
|
"""Core.restore_state fixture."""
|
||||||
|
|
||||||
def _storage(entity_id, uom, state):
|
def _storage(entity_id, uom, state):
|
||||||
|
@ -64,6 +64,7 @@ from .conftest import (
|
|||||||
from .data import BASE_CUSTOM_CONFIGURATION, CONFIG_WITH_ALARM_OPTIONS
|
from .data import BASE_CUSTOM_CONFIGURATION, CONFIG_WITH_ALARM_OPTIONS
|
||||||
|
|
||||||
from tests.common import MockConfigEntry, MockUser
|
from tests.common import MockConfigEntry, MockUser
|
||||||
|
from tests.typing import MockHAClientWebSocket, WebSocketGenerator
|
||||||
|
|
||||||
IEEE_SWITCH_DEVICE = "01:2d:6f:00:0a:90:69:e7"
|
IEEE_SWITCH_DEVICE = "01:2d:6f:00:0a:90:69:e7"
|
||||||
IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8"
|
IEEE_GROUPABLE_DEVICE = "01:2d:6f:00:0a:90:69:e8"
|
||||||
@ -151,7 +152,12 @@ async def device_groupable(hass, zigpy_device_mock, zha_device_joined):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
async def zha_client(hass, hass_ws_client, device_switch, device_groupable):
|
async def zha_client(
|
||||||
|
hass: HomeAssistant,
|
||||||
|
hass_ws_client: WebSocketGenerator,
|
||||||
|
device_switch,
|
||||||
|
device_groupable,
|
||||||
|
) -> MockHAClientWebSocket:
|
||||||
"""Get ZHA WebSocket client."""
|
"""Get ZHA WebSocket client."""
|
||||||
|
|
||||||
# load the ZHA API
|
# load the ZHA API
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Test zone component."""
|
"""Test zone component."""
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -24,7 +25,7 @@ from tests.typing import WebSocketGenerator
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def storage_setup(hass, hass_storage):
|
def storage_setup(hass: HomeAssistant, hass_storage: dict[str, Any]):
|
||||||
"""Storage setup."""
|
"""Storage setup."""
|
||||||
|
|
||||||
async def _storage(items=None, config=None):
|
async def _storage(items=None, config=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user