mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 09:47:52 +00:00
Fix test fixture annotations (#122180)
This commit is contained in:
parent
281c66b6c2
commit
53c85a5c9b
@ -14,7 +14,7 @@ from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def platforms() -> AsyncGenerator[list[str]]:
|
||||
async def platforms() -> AsyncGenerator[None]:
|
||||
"""Return the platforms to be loaded for this test."""
|
||||
with patch("homeassistant.components.aosmith.PLATFORMS", [Platform.SENSOR]):
|
||||
yield
|
||||
|
@ -29,7 +29,7 @@ from tests.common import MockConfigEntry, snapshot_platform
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def platforms() -> AsyncGenerator[list[str]]:
|
||||
async def platforms() -> AsyncGenerator[None]:
|
||||
"""Return the platforms to be loaded for this test."""
|
||||
with patch("homeassistant.components.aosmith.PLATFORMS", [Platform.WATER_HEATER]):
|
||||
yield
|
||||
|
@ -17,7 +17,7 @@ def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def ccm15_device() -> Generator[AsyncMock]:
|
||||
def ccm15_device() -> Generator[None]:
|
||||
"""Mock ccm15 device."""
|
||||
ccm15_devices = {
|
||||
0: CCM15SlaveDevice(bytes.fromhex("000000b0b8001b")),
|
||||
@ -32,7 +32,7 @@ def ccm15_device() -> Generator[AsyncMock]:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def network_failure_ccm15_device() -> Generator[AsyncMock]:
|
||||
def network_failure_ccm15_device() -> Generator[None]:
|
||||
"""Mock empty set of ccm15 device."""
|
||||
device_state = CCM15DeviceState(devices={})
|
||||
with patch(
|
||||
|
@ -1,10 +1,11 @@
|
||||
"""Unit test for CCM15 coordinator component."""
|
||||
|
||||
from datetime import timedelta
|
||||
from unittest.mock import AsyncMock, patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from ccm15 import CCM15DeviceState
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.ccm15.const import DOMAIN
|
||||
@ -27,11 +28,11 @@ from homeassistant.helpers import entity_registry as er
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("ccm15_device")
|
||||
async def test_climate_state(
|
||||
hass: HomeAssistant,
|
||||
snapshot: SnapshotAssertion,
|
||||
entity_registry: er.EntityRegistry,
|
||||
ccm15_device: AsyncMock,
|
||||
freezer: FrozenDateTimeFactory,
|
||||
) -> None:
|
||||
"""Test the coordinator."""
|
||||
|
@ -1,7 +1,6 @@
|
||||
"""Test CCM15 diagnostics."""
|
||||
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.ccm15.const import DOMAIN
|
||||
@ -13,10 +12,10 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("ccm15_device")
|
||||
async def test_entry_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
ccm15_device: AsyncMock,
|
||||
snapshot: SnapshotAssertion,
|
||||
) -> None:
|
||||
"""Test config entry diagnostics."""
|
||||
|
@ -1,6 +1,6 @@
|
||||
"""Tests for the ccm15 component."""
|
||||
|
||||
from unittest.mock import AsyncMock
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.ccm15.const import DOMAIN
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
@ -10,7 +10,8 @@ from homeassistant.core import HomeAssistant
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
async def test_load_unload(hass: HomeAssistant, ccm15_device: AsyncMock) -> None:
|
||||
@pytest.mark.usefixtures("ccm15_device")
|
||||
async def test_load_unload(hass: HomeAssistant) -> None:
|
||||
"""Test options flow."""
|
||||
entry = MockConfigEntry(
|
||||
domain=DOMAIN,
|
||||
|
@ -17,7 +17,7 @@ from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def platforms_fixture() -> Generator[list[str]]:
|
||||
def platforms_fixture() -> Generator[None]:
|
||||
"""Return the platforms to be loaded for this test."""
|
||||
# Arbitrary platform to ensure notifications are loaded
|
||||
with patch("homeassistant.components.flume.PLATFORMS", [Platform.BINARY_SENSOR]):
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Common fixtures for Hunter Douglas Powerview tests."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
|
||||
from unittest.mock import AsyncMock, PropertyMock, patch
|
||||
|
||||
from aiopvapi.resources.shade import ShadePosition
|
||||
import pytest
|
||||
@ -29,7 +29,7 @@ def mock_hunterdouglas_hub(
|
||||
rooms_json: str,
|
||||
scenes_json: str,
|
||||
shades_json: str,
|
||||
) -> Generator[MagicMock]:
|
||||
) -> Generator[None]:
|
||||
"""Return a mocked Powerview Hub with all data populated."""
|
||||
with (
|
||||
patch(
|
||||
|
@ -14,10 +14,10 @@ from .const import MOCK_MAC
|
||||
from tests.common import MockConfigEntry
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("mock_hunterdouglas_hub")
|
||||
@pytest.mark.parametrize("api_version", [1, 2, 3])
|
||||
async def test_scenes(
|
||||
hass: HomeAssistant,
|
||||
mock_hunterdouglas_hub: None,
|
||||
api_version: int,
|
||||
) -> None:
|
||||
"""Test the scenes."""
|
||||
|
@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from gotailwind import TailwindDeviceStatus
|
||||
import pytest
|
||||
@ -36,7 +36,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
def mock_setup_entry() -> Generator[None]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch(
|
||||
"homeassistant.components.tailwind.async_setup_entry", return_value=True
|
||||
|
@ -3,7 +3,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
@ -35,7 +35,7 @@ def mock_config_entry() -> MockConfigEntry:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_setup_entry() -> Generator[AsyncMock]:
|
||||
def mock_setup_entry() -> Generator[None]:
|
||||
"""Mock setting up a config entry."""
|
||||
with patch("homeassistant.components.tuya.async_setup_entry", return_value=True):
|
||||
yield
|
||||
|
Loading…
x
Reference in New Issue
Block a user