mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 19:57:03 -04:00
Expose radio frequency fixtures in pytest-home-assistant (#187092)
This commit is contained in:
@@ -133,6 +133,7 @@ if TYPE_CHECKING:
|
||||
MockInfraredEmitterEntity,
|
||||
MockInfraredReceiverEntity,
|
||||
)
|
||||
from .components.radio_frequency.common import MockRadioFrequencyEntity
|
||||
|
||||
|
||||
pytest.register_assert_rewrite("pytest_homeassistant.common")
|
||||
@@ -2046,6 +2047,24 @@ def mock_recorder_before_hass() -> None:
|
||||
"""
|
||||
|
||||
|
||||
@pytest.fixture(name="init_radio_frequency")
|
||||
async def init_radio_frequency_fixture(hass: HomeAssistant) -> None:
|
||||
"""Set up the Radio Frequency integration for testing."""
|
||||
from .components.radio_frequency.common import init_radio_frequency_fixture_helper # noqa: PLC0415
|
||||
|
||||
await init_radio_frequency_fixture_helper(hass)
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_rf_entity")
|
||||
async def mock_rf_entity_fixture(
|
||||
hass: HomeAssistant, init_radio_frequency: None
|
||||
) -> MockRadioFrequencyEntity:
|
||||
"""Return a mock radio frequency entity."""
|
||||
from .components.radio_frequency.common import mock_rf_entity_fixture_helper # noqa: PLC0415
|
||||
|
||||
return await mock_rf_entity_fixture_helper(hass)
|
||||
|
||||
|
||||
@pytest.fixture(name="init_infrared")
|
||||
async def init_infrared_fixture(hass: HomeAssistant) -> None:
|
||||
"""Set up the Infrared integration for testing."""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Compatibility imports for the Home Assistant pytest helpers."""
|
||||
"""Tests for the Bluetooth integration."""
|
||||
|
||||
from pytest_homeassistant.components.bluetooth import (
|
||||
ADVERTISEMENT_DATA_DEFAULTS as ADVERTISEMENT_DATA_DEFAULTS,
|
||||
|
||||
@@ -58,8 +58,10 @@ import probatio
|
||||
import pytest
|
||||
from pytest_homeassistant.plugins import (
|
||||
init_infrared_fixture as init_infrared_fixture,
|
||||
init_radio_frequency_fixture as init_radio_frequency_fixture,
|
||||
mock_infrared_emitter_entity_fixture as mock_infrared_emitter_entity_fixture,
|
||||
mock_infrared_receiver_entity_fixture as mock_infrared_receiver_entity_fixture,
|
||||
mock_rf_entity_fixture as mock_rf_entity_fixture,
|
||||
)
|
||||
|
||||
from homeassistant import components, loader
|
||||
@@ -104,7 +106,6 @@ if TYPE_CHECKING:
|
||||
from .conversation import MockAgent
|
||||
from .device_tracker.common import MockScanner
|
||||
from .light.common import MockLight
|
||||
from .radio_frequency.common import MockRadioFrequencyEntity
|
||||
from .sensor.common import MockSensor
|
||||
from .switch.common import MockSwitch
|
||||
|
||||
@@ -207,25 +208,6 @@ def mock_conversation_agent_fixture(hass: HomeAssistant) -> MockAgent:
|
||||
return mock_conversation_agent_fixture_helper(hass)
|
||||
|
||||
|
||||
# Radio frequency test fixtures
|
||||
@pytest.fixture(name="init_radio_frequency")
|
||||
async def init_radio_frequency_fixture(hass: HomeAssistant) -> None:
|
||||
"""Set up the Radio Frequency integration for testing."""
|
||||
from .radio_frequency.common import init_radio_frequency_fixture_helper # noqa: PLC0415
|
||||
|
||||
await init_radio_frequency_fixture_helper(hass)
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_rf_entity")
|
||||
async def mock_rf_entity_fixture(
|
||||
hass: HomeAssistant, init_radio_frequency: None
|
||||
) -> MockRadioFrequencyEntity:
|
||||
"""Return a mock radio frequency entity."""
|
||||
from .radio_frequency.common import mock_rf_entity_fixture_helper # noqa: PLC0415
|
||||
|
||||
return await mock_rf_entity_fixture_helper(hass)
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=find_spec("haffmpeg") is not None)
|
||||
def prevent_ffmpeg_subprocess() -> Generator[None]:
|
||||
"""If installed, prevent ffmpeg from creating a subprocess."""
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Compatibility imports for the Home Assistant pytest helpers."""
|
||||
"""Tests for the infrared integration."""
|
||||
|
||||
from pytest_homeassistant.components.infrared import (
|
||||
EMITTER_ENTITY_ID as EMITTER_ENTITY_ID,
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"""Compatibility imports for the Home Assistant pytest helpers."""
|
||||
"""Tests for the radio frequency integration."""
|
||||
|
||||
from pytest_homeassistant.components.radio_frequency import ENTITY_ID as ENTITY_ID
|
||||
|
||||
Reference in New Issue
Block a user