mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Always setup demo platforms with device support from config entry (#94586)
* Always setup demo platforms with device support from config entry * Adjust test fixutres * Update tests depending on the demo integration
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import timedelta
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import light
|
||||
from homeassistant.components.light import (
|
||||
@@ -14,7 +17,7 @@ from homeassistant.components.light import (
|
||||
)
|
||||
from homeassistant.components.recorder import Recorder
|
||||
from homeassistant.components.recorder.history import get_significant_states
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME
|
||||
from homeassistant.const import ATTR_FRIENDLY_NAME, Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
@@ -23,6 +26,16 @@ from tests.common import async_fire_time_changed
|
||||
from tests.components.recorder.common import async_wait_recording_done
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
async def light_only() -> None:
|
||||
"""Enable only the light platform."""
|
||||
with patch(
|
||||
"homeassistant.components.demo.COMPONENTS_WITH_CONFIG_ENTRY_DEMO_PLATFORM",
|
||||
[Platform.LIGHT],
|
||||
):
|
||||
yield
|
||||
|
||||
|
||||
async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant) -> None:
|
||||
"""Test light registered attributes to be excluded."""
|
||||
now = dt_util.utcnow()
|
||||
|
||||
Reference in New Issue
Block a user