Adjust conftest type hints (#117900)
This commit is contained in:
parent
39b4e890a0
commit
cddb057eae
1 changed files with 12 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
||||||
"""Fixtures for component testing."""
|
"""Fixtures for component testing."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections.abc import Callable, Generator
|
from collections.abc import Callable, Generator
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
@ -9,13 +11,12 @@ import pytest
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
|
|
||||||
from tests.components.conversation import MockAgent
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from tests.components.device_tracker.common import MockScanner
|
from .conversation import MockAgent
|
||||||
from tests.components.light.common import MockLight
|
from .device_tracker.common import MockScanner
|
||||||
from tests.components.sensor.common import MockSensor
|
from .light.common import MockLight
|
||||||
from tests.components.switch.common import MockSwitch
|
from .sensor.common import MockSensor
|
||||||
|
from .switch.common import MockSwitch
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session", autouse=True)
|
@pytest.fixture(scope="session", autouse=True)
|
||||||
|
@ -125,7 +126,7 @@ def prevent_ffmpeg_subprocess() -> Generator[None, None, None]:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_light_entities() -> list["MockLight"]:
|
def mock_light_entities() -> list[MockLight]:
|
||||||
"""Return mocked light entities."""
|
"""Return mocked light entities."""
|
||||||
from tests.components.light.common import MockLight
|
from tests.components.light.common import MockLight
|
||||||
|
|
||||||
|
@ -137,7 +138,7 @@ def mock_light_entities() -> list["MockLight"]:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_sensor_entities() -> dict[str, "MockSensor"]:
|
def mock_sensor_entities() -> dict[str, MockSensor]:
|
||||||
"""Return mocked sensor entities."""
|
"""Return mocked sensor entities."""
|
||||||
from tests.components.sensor.common import get_mock_sensor_entities
|
from tests.components.sensor.common import get_mock_sensor_entities
|
||||||
|
|
||||||
|
@ -145,7 +146,7 @@ def mock_sensor_entities() -> dict[str, "MockSensor"]:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_switch_entities() -> list["MockSwitch"]:
|
def mock_switch_entities() -> list[MockSwitch]:
|
||||||
"""Return mocked toggle entities."""
|
"""Return mocked toggle entities."""
|
||||||
from tests.components.switch.common import get_mock_switch_entities
|
from tests.components.switch.common import get_mock_switch_entities
|
||||||
|
|
||||||
|
@ -153,7 +154,7 @@ def mock_switch_entities() -> list["MockSwitch"]:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_legacy_device_scanner() -> "MockScanner":
|
def mock_legacy_device_scanner() -> MockScanner:
|
||||||
"""Return mocked legacy device scanner entity."""
|
"""Return mocked legacy device scanner entity."""
|
||||||
from tests.components.device_tracker.common import MockScanner
|
from tests.components.device_tracker.common import MockScanner
|
||||||
|
|
||||||
|
@ -161,9 +162,7 @@ def mock_legacy_device_scanner() -> "MockScanner":
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mock_legacy_device_tracker_setup() -> (
|
def mock_legacy_device_tracker_setup() -> Callable[[HomeAssistant, MockScanner], None]:
|
||||||
Callable[[HomeAssistant, "MockScanner"], None]
|
|
||||||
):
|
|
||||||
"""Return setup callable for legacy device tracker setup."""
|
"""Return setup callable for legacy device tracker setup."""
|
||||||
from tests.components.device_tracker.common import mock_legacy_device_tracker_setup
|
from tests.components.device_tracker.common import mock_legacy_device_tracker_setup
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue