Move enable_custom_integrations fixture to decorator (#118844)

This commit is contained in:
epenet 2024-06-05 09:20:08 +02:00 committed by GitHub
parent 985e42e50c
commit c7e065c413
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
32 changed files with 112 additions and 121 deletions

View File

@ -566,10 +566,10 @@ async def test_reusing_uuid(
assert analytics.uuid == "NOT_MOCK_UUID" assert analytics.uuid == "NOT_MOCK_UUID"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_custom_integrations( async def test_custom_integrations(
hass: HomeAssistant, hass: HomeAssistant,
aioclient_mock: AiohttpClientMocker, aioclient_mock: AiohttpClientMocker,
enable_custom_integrations: None,
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
installation_type_mock: Generator[Any, Any, None], installation_type_mock: Generator[Any, Any, None],
snapshot: SnapshotAssertion, snapshot: SnapshotAssertion,

View File

@ -55,12 +55,11 @@ async def test_button(hass: HomeAssistant) -> None:
assert button.press.called assert button.press.called
@pytest.mark.usefixtures("enable_custom_integrations", "setup_platform")
async def test_custom_integration( async def test_custom_integration(
hass: HomeAssistant, hass: HomeAssistant,
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
enable_custom_integrations: None,
freezer: FrozenDateTimeFactory, freezer: FrozenDateTimeFactory,
setup_platform: None,
) -> None: ) -> None:
"""Test we integration.""" """Test we integration."""
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}}) assert await async_setup_component(hass, DOMAIN, {DOMAIN: {CONF_PLATFORM: "test"}})
@ -95,9 +94,8 @@ async def test_custom_integration(
assert hass.states.get("button.button_1").state == new_time_isoformat assert hass.states.get("button.button_1").state == new_time_isoformat
async def test_restore_state( @pytest.mark.usefixtures("enable_custom_integrations", "setup_platform")
hass: HomeAssistant, enable_custom_integrations: None, setup_platform: None async def test_restore_state(hass: HomeAssistant) -> None:
) -> None:
"""Test we restore state integration.""" """Test we restore state integration."""
mock_restore_cache(hass, (State("button.button_1", "2021-01-01T23:59:59+00:00"),)) mock_restore_cache(hass, (State("button.button_1", "2021-01-01T23:59:59+00:00"),))
@ -107,9 +105,8 @@ async def test_restore_state(
assert hass.states.get("button.button_1").state == "2021-01-01T23:59:59+00:00" assert hass.states.get("button.button_1").state == "2021-01-01T23:59:59+00:00"
async def test_restore_state_does_not_restore_unavailable( @pytest.mark.usefixtures("enable_custom_integrations", "setup_platform")
hass: HomeAssistant, enable_custom_integrations: None, setup_platform: None async def test_restore_state_does_not_restore_unavailable(hass: HomeAssistant) -> None:
) -> None:
"""Test we restore state integration except for unavailable.""" """Test we restore state integration except for unavailable."""
mock_restore_cache(hass, (State("button.button_1", STATE_UNAVAILABLE),)) mock_restore_cache(hass, (State("button.button_1", STATE_UNAVAILABLE),))

View File

@ -507,9 +507,8 @@ async def test_abort(hass: HomeAssistant, client) -> None:
} }
async def test_create_account( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, client, enable_custom_integrations: None async def test_create_account(hass: HomeAssistant, client) -> None:
) -> None:
"""Test a flow that creates an account.""" """Test a flow that creates an account."""
mock_platform(hass, "test.config_flow", None) mock_platform(hass, "test.config_flow", None)
@ -566,9 +565,8 @@ async def test_create_account(
} }
async def test_two_step_flow( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, client, enable_custom_integrations: None async def test_two_step_flow(hass: HomeAssistant, client) -> None:
) -> None:
"""Test we can finish a two step flow.""" """Test we can finish a two step flow."""
mock_integration( mock_integration(
hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True)) hass, MockModule("test", async_setup_entry=AsyncMock(return_value=True))
@ -2227,9 +2225,8 @@ async def test_flow_with_multiple_schema_errors_base(
} }
async def test_supports_reconfigure( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, client, enable_custom_integrations: None async def test_supports_reconfigure(hass: HomeAssistant, client) -> None:
) -> None:
"""Test a flow that support reconfigure step.""" """Test a flow that support reconfigure step."""
mock_platform(hass, "test.config_flow", None) mock_platform(hass, "test.config_flow", None)
@ -2317,8 +2314,9 @@ async def test_supports_reconfigure(
} }
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_does_not_support_reconfigure( async def test_does_not_support_reconfigure(
hass: HomeAssistant, client: TestClient, enable_custom_integrations: None hass: HomeAssistant, client: TestClient
) -> None: ) -> None:
"""Test a flow that does not support reconfigure step.""" """Test a flow that does not support reconfigure step."""
mock_platform(hass, "test.config_flow", None) mock_platform(hass, "test.config_flow", None)

View File

@ -108,9 +108,8 @@ async def test_lights_on_when_sun_sets(
) )
async def test_lights_turn_off_when_everyone_leaves( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, enable_custom_integrations: None async def test_lights_turn_off_when_everyone_leaves(hass: HomeAssistant) -> None:
) -> None:
"""Test lights turn off when everyone leaves the house.""" """Test lights turn off when everyone leaves the house."""
assert await async_setup_component( assert await async_setup_component(
hass, "light", {light.DOMAIN: {CONF_PLATFORM: "test"}} hass, "light", {light.DOMAIN: {CONF_PLATFORM: "test"}}

View File

@ -80,10 +80,9 @@ async def test_websocket(
} }
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_download_diagnostics( async def test_download_diagnostics(
hass: HomeAssistant, hass: HomeAssistant, hass_client: ClientSessionGenerator
hass_client: ClientSessionGenerator,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test download diagnostics.""" """Test download diagnostics."""
config_entry = MockConfigEntry(domain="fake_integration") config_entry = MockConfigEntry(domain="fake_integration")

View File

@ -3,6 +3,8 @@
import asyncio import asyncio
from unittest.mock import patch from unittest.mock import patch
import pytest
from homeassistant import config as hass_config from homeassistant import config as hass_config
from homeassistant.components.group import DOMAIN, SERVICE_RELOAD from homeassistant.components.group import DOMAIN, SERVICE_RELOAD
from homeassistant.components.switch import ( from homeassistant.components.switch import (
@ -232,9 +234,8 @@ async def test_state_reporting_all(hass: HomeAssistant) -> None:
assert hass.states.get("switch.switch_group").state == STATE_UNAVAILABLE assert hass.states.get("switch.switch_group").state == STATE_UNAVAILABLE
async def test_service_calls( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, enable_custom_integrations: None async def test_service_calls(hass: HomeAssistant) -> None:
) -> None:
"""Test service calls.""" """Test service calls."""
await async_setup_component( await async_setup_component(
hass, hass,

View File

@ -89,11 +89,11 @@ async def test_setup_component_with_service(hass: HomeAssistant) -> None:
"homeassistant.components.demo.camera.Path.read_bytes", "homeassistant.components.demo.camera.Path.read_bytes",
return_value=b"Test", return_value=b"Test",
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_image_from_camera( async def test_get_image_from_camera(
mock_camera_read, mock_camera_read,
hass: HomeAssistant, hass: HomeAssistant,
aiohttp_unused_port_factory, aiohttp_unused_port_factory,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Grab an image from camera entity.""" """Grab an image from camera entity."""
await setup_image_processing(hass, aiohttp_unused_port_factory) await setup_image_processing(hass, aiohttp_unused_port_factory)
@ -112,11 +112,11 @@ async def test_get_image_from_camera(
"homeassistant.components.image_processing.async_get_image", "homeassistant.components.image_processing.async_get_image",
side_effect=HomeAssistantError(), side_effect=HomeAssistantError(),
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_image_without_exists_camera( async def test_get_image_without_exists_camera(
mock_image, mock_image,
hass: HomeAssistant, hass: HomeAssistant,
aiohttp_unused_port_factory, aiohttp_unused_port_factory,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Try to get image without exists camera.""" """Try to get image without exists camera."""
await setup_image_processing(hass, aiohttp_unused_port_factory) await setup_image_processing(hass, aiohttp_unused_port_factory)
@ -188,10 +188,10 @@ async def test_face_event_call_no_confidence(
assert event_data[0]["entity_id"] == "image_processing.demo_face" assert event_data[0]["entity_id"] == "image_processing.demo_face"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_update_missing_camera( async def test_update_missing_camera(
hass: HomeAssistant, hass: HomeAssistant,
aiohttp_unused_port_factory, aiohttp_unused_port_factory,
enable_custom_integrations: None,
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
) -> None: ) -> None:
"""Test when entity does not set camera.""" """Test when entity does not set camera."""

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_boolean import DOMAIN from homeassistant.components.input_boolean import DOMAIN
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -16,9 +17,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}}) assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}})

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_button import DOMAIN from homeassistant.components.input_button import DOMAIN
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -16,9 +17,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}}) assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}})

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_datetime import CONF_HAS_DATE, CONF_HAS_TIME, DOMAIN from homeassistant.components.input_datetime import CONF_HAS_DATE, CONF_HAS_TIME, DOMAIN
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -16,9 +17,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component( assert await async_setup_component(

View File

@ -4,6 +4,8 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_number import ( from homeassistant.components.input_number import (
ATTR_MAX, ATTR_MAX,
ATTR_MIN, ATTR_MIN,
@ -11,7 +13,6 @@ from homeassistant.components.input_number import (
ATTR_STEP, ATTR_STEP,
DOMAIN, DOMAIN,
) )
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -22,9 +23,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component( assert await async_setup_component(

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_select import ATTR_OPTIONS, DOMAIN from homeassistant.components.input_select import ATTR_OPTIONS, DOMAIN
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -16,9 +17,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component( assert await async_setup_component(

View File

@ -4,6 +4,8 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.input_text import ( from homeassistant.components.input_text import (
ATTR_MAX, ATTR_MAX,
ATTR_MIN, ATTR_MIN,
@ -12,7 +14,6 @@ from homeassistant.components.input_text import (
DOMAIN, DOMAIN,
MODE_TEXT, MODE_TEXT,
) )
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.const import ATTR_EDITABLE from homeassistant.const import ATTR_EDITABLE
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
@ -23,9 +24,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}}) assert await async_setup_component(hass, DOMAIN, {DOMAIN: {"test": {}}})

View File

@ -466,12 +466,12 @@ async def test_get_action_capabilities_features_legacy(
assert capabilities == expected assert capabilities == expected
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action( async def test_action(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -631,12 +631,12 @@ async def test_action(
assert turn_on_calls[-1].data == {"entity_id": entry.entity_id, "flash": FLASH_LONG} assert turn_on_calls[-1].data == {"entity_id": entry.entity_id, "flash": FLASH_LONG}
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action_legacy( async def test_action_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -180,12 +180,12 @@ async def test_get_condition_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state( async def test_if_state(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -267,12 +267,12 @@ async def test_if_state(
assert calls[1].data["some"] == "is_off event - test_event2" assert calls[1].data["some"] == "is_off event - test_event2"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_legacy( async def test_if_state_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -184,12 +184,12 @@ async def test_get_trigger_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change( async def test_if_fires_on_state_change(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -277,12 +277,12 @@ async def test_if_fires_on_state_change(
} }
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_legacy( async def test_if_fires_on_state_change_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -331,12 +331,12 @@ async def test_if_fires_on_state_change_legacy(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_with_for( async def test_if_fires_on_state_change_with_for(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for triggers firing with delay.""" """Test for triggers firing with delay."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -980,9 +980,9 @@ async def test_light_brightness_step(hass: HomeAssistant) -> None:
assert entity0.state == "off" # 126 - 126; brightness is 0, light should turn off assert entity0.state == "off" # 126 - 126; brightness is 0, light should turn off
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_light_brightness_pct_conversion( async def test_light_brightness_pct_conversion(
hass: HomeAssistant, hass: HomeAssistant,
enable_custom_integrations: None,
mock_light_entities: list[MockLight], mock_light_entities: list[MockLight],
) -> None: ) -> None:
"""Test that light brightness percent conversion.""" """Test that light brightness percent conversion."""

View File

@ -4,8 +4,9 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
import pytest
from homeassistant.components.person import ATTR_DEVICE_TRACKERS, DOMAIN from homeassistant.components.person import ATTR_DEVICE_TRACKERS, DOMAIN
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component
@ -15,10 +16,9 @@ from tests.common import MockUser, async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
@pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
async def test_exclude_attributes( async def test_exclude_attributes(
recorder_mock: Recorder,
hass: HomeAssistant, hass: HomeAssistant,
enable_custom_integrations: None,
hass_admin_user: MockUser, hass_admin_user: MockUser,
storage_setup, storage_setup,
) -> None: ) -> None:

View File

@ -109,12 +109,12 @@ async def test_get_actions_hidden_auxiliary(
assert actions == unordered(expected_actions) assert actions == unordered(expected_actions)
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action( async def test_action(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -184,12 +184,12 @@ async def test_action(
assert turn_on_calls[-1].data == {"entity_id": entry.entity_id} assert turn_on_calls[-1].data == {"entity_id": entry.entity_id}
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action_legacy( async def test_action_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -178,12 +178,12 @@ async def test_get_condition_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state( async def test_if_state(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -265,12 +265,12 @@ async def test_if_state(
assert calls[1].data["some"] == "is_off event - test_event2" assert calls[1].data["some"] == "is_off event - test_event2"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_legacy( async def test_if_state_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -324,12 +324,12 @@ async def test_if_state_legacy(
assert calls[0].data["some"] == "is_on event - test_event1" assert calls[0].data["some"] == "is_on event - test_event1"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_for_condition( async def test_if_fires_on_for_condition(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for firing if condition is on with delay.""" """Test for firing if condition is on with delay."""
point1 = dt_util.utcnow() point1 = dt_util.utcnow()

View File

@ -176,12 +176,12 @@ async def test_get_trigger_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change( async def test_if_fires_on_state_change(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -286,12 +286,12 @@ async def test_if_fires_on_state_change(
} }
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_legacy( async def test_if_fires_on_state_change_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -346,12 +346,12 @@ async def test_if_fires_on_state_change_legacy(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_with_for( async def test_if_fires_on_state_change_with_for(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for triggers firing with delay.""" """Test for triggers firing with delay."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -37,8 +37,9 @@ def entities(
return entities return entities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_config_yaml_alias_anchor( async def test_config_yaml_alias_anchor(
hass: HomeAssistant, entities, enable_custom_integrations: None hass: HomeAssistant, entities: list[MockLight]
) -> None: ) -> None:
"""Test the usage of YAML aliases and anchors. """Test the usage of YAML aliases and anchors.
@ -84,9 +85,8 @@ async def test_config_yaml_alias_anchor(
assert light_2.last_call("turn_on")[1].get("brightness") == 100 assert light_2.last_call("turn_on")[1].get("brightness") == 100
async def test_config_yaml_bool( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, entities, enable_custom_integrations: None async def test_config_yaml_bool(hass: HomeAssistant, entities: list[MockLight]) -> None:
) -> None:
"""Test parsing of booleans in yaml config.""" """Test parsing of booleans in yaml config."""
light_1, light_2 = await setup_lights(hass, entities) light_1, light_2 = await setup_lights(hass, entities)
@ -113,9 +113,8 @@ async def test_config_yaml_bool(
assert light_2.last_call("turn_on")[1].get("brightness") == 100 assert light_2.last_call("turn_on")[1].get("brightness") == 100
async def test_activate_scene( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, entities, enable_custom_integrations: None async def test_activate_scene(hass: HomeAssistant, entities: list[MockLight]) -> None:
) -> None:
"""Test active scene.""" """Test active scene."""
light_1, light_2 = await setup_lights(hass, entities) light_1, light_2 = await setup_lights(hass, entities)
@ -167,9 +166,8 @@ async def test_activate_scene(
assert calls[0].data.get("transition") == 42 assert calls[0].data.get("transition") == 42
async def test_restore_state( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, entities, enable_custom_integrations: None async def test_restore_state(hass: HomeAssistant, entities: list[MockLight]) -> None:
) -> None:
"""Test we restore state integration.""" """Test we restore state integration."""
mock_restore_cache(hass, (State("scene.test", "2021-01-01T23:59:59+00:00"),)) mock_restore_cache(hass, (State("scene.test", "2021-01-01T23:59:59+00:00"),))
@ -195,8 +193,9 @@ async def test_restore_state(
assert hass.states.get("scene.test").state == "2021-01-01T23:59:59+00:00" assert hass.states.get("scene.test").state == "2021-01-01T23:59:59+00:00"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_restore_state_does_not_restore_unavailable( async def test_restore_state_does_not_restore_unavailable(
hass: HomeAssistant, entities, enable_custom_integrations: None hass: HomeAssistant, entities: list[MockLight]
) -> None: ) -> None:
"""Test we restore state integration but ignore unavailable.""" """Test we restore state integration but ignore unavailable."""
mock_restore_cache(hass, (State("scene.test", STATE_UNAVAILABLE),)) mock_restore_cache(hass, (State("scene.test", STATE_UNAVAILABLE),))

View File

@ -4,7 +4,8 @@ from __future__ import annotations
from datetime import timedelta from datetime import timedelta
from homeassistant.components.recorder import Recorder import pytest
from homeassistant.components.recorder.history import get_significant_states from homeassistant.components.recorder.history import get_significant_states
from homeassistant.components.schedule.const import ATTR_NEXT_EVENT, DOMAIN from homeassistant.components.schedule.const import ATTR_NEXT_EVENT, DOMAIN
from homeassistant.const import ATTR_EDITABLE, ATTR_FRIENDLY_NAME, ATTR_ICON from homeassistant.const import ATTR_EDITABLE, ATTR_FRIENDLY_NAME, ATTR_ICON
@ -16,11 +17,8 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes( @pytest.mark.usefixtures("recorder_mock", "enable_custom_integrations")
recorder_mock: Recorder, async def test_exclude_attributes(hass: HomeAssistant) -> None:
hass: HomeAssistant,
enable_custom_integrations: None,
) -> None:
"""Test attributes to be excluded.""" """Test attributes to be excluded."""
now = dt_util.utcnow() now = dt_util.utcnow()
assert await async_setup_component( assert await async_setup_component(

View File

@ -462,13 +462,13 @@ async def test_get_condition_capabilities_none(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_not_above_below( async def test_if_state_not_above_below(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for bad value conditions.""" """Test for bad value conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -505,12 +505,12 @@ async def test_if_state_not_above_below(
assert "must contain at least one of below, above" in caplog.text assert "must contain at least one of below, above" in caplog.text
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_above( async def test_if_state_above(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value conditions.""" """Test for value conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -574,12 +574,12 @@ async def test_if_state_above(
assert calls[0].data["some"] == "event - test_event1" assert calls[0].data["some"] == "event - test_event1"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_above_legacy( async def test_if_state_above_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value conditions.""" """Test for value conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -643,12 +643,12 @@ async def test_if_state_above_legacy(
assert calls[0].data["some"] == "event - test_event1" assert calls[0].data["some"] == "event - test_event1"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_below( async def test_if_state_below(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value conditions.""" """Test for value conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -712,12 +712,12 @@ async def test_if_state_below(
assert calls[0].data["some"] == "event - test_event1" assert calls[0].data["some"] == "event - test_event1"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_between( async def test_if_state_between(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value conditions.""" """Test for value conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -419,13 +419,13 @@ async def test_get_trigger_capabilities_none(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_not_on_above_below( async def test_if_fires_not_on_above_below(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
caplog: pytest.LogCaptureFixture, caplog: pytest.LogCaptureFixture,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value triggers firing.""" """Test for value triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -459,12 +459,12 @@ async def test_if_fires_not_on_above_below(
assert "must contain at least one of below, above" in caplog.text assert "must contain at least one of below, above" in caplog.text
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_above( async def test_if_fires_on_state_above(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value triggers firing.""" """Test for value triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -524,12 +524,12 @@ async def test_if_fires_on_state_above(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_below( async def test_if_fires_on_state_below(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value triggers firing.""" """Test for value triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -589,12 +589,12 @@ async def test_if_fires_on_state_below(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_between( async def test_if_fires_on_state_between(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value triggers firing.""" """Test for value triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -666,12 +666,12 @@ async def test_if_fires_on_state_between(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_legacy( async def test_if_fires_on_state_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for value triggers firing.""" """Test for value triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -731,12 +731,12 @@ async def test_if_fires_on_state_legacy(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_with_for( async def test_if_fires_on_state_change_with_for(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for triggers firing with delay.""" """Test for triggers firing with delay."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -5234,9 +5234,8 @@ async def async_record_states_partially_unavailable(hass, zero, entity_id, attri
return four, states return four, states
async def test_exclude_attributes( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, enable_custom_integrations: None async def test_exclude_attributes(hass: HomeAssistant) -> None:
) -> None:
"""Test sensor attributes to be excluded.""" """Test sensor attributes to be excluded."""
entity0 = MockSensor( entity0 = MockSensor(
has_entity_name=True, has_entity_name=True,

View File

@ -110,12 +110,12 @@ async def test_get_actions_hidden_auxiliary(
assert actions == unordered(expected_actions) assert actions == unordered(expected_actions)
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action( async def test_action(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -185,12 +185,12 @@ async def test_action(
assert turn_on_calls[-1].data == {"entity_id": entry.entity_id} assert turn_on_calls[-1].data == {"entity_id": entry.entity_id}
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_action_legacy( async def test_action_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off actions.""" """Test for turn_on and turn_off actions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -178,12 +178,12 @@ async def test_get_condition_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state( async def test_if_state(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -265,12 +265,12 @@ async def test_if_state(
assert calls[1].data["some"] == "is_off event - test_event2" assert calls[1].data["some"] == "is_off event - test_event2"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_state_legacy( async def test_if_state_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off conditions.""" """Test for turn_on and turn_off conditions."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -323,12 +323,12 @@ async def test_if_state_legacy(
assert calls[0].data["some"] == "is_on event - test_event1" assert calls[0].data["some"] == "is_on event - test_event1"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_for_condition( async def test_if_fires_on_for_condition(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for firing if condition is on with delay.""" """Test for firing if condition is on with delay."""
point1 = dt_util.utcnow() point1 = dt_util.utcnow()

View File

@ -176,12 +176,12 @@ async def test_get_trigger_capabilities_legacy(
assert capabilities == expected_capabilities assert capabilities == expected_capabilities
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change( async def test_if_fires_on_state_change(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -287,12 +287,12 @@ async def test_if_fires_on_state_change(
} }
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_legacy( async def test_if_fires_on_state_change_legacy(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for turn_on and turn_off triggers firing.""" """Test for turn_on and turn_off triggers firing."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})
@ -348,12 +348,12 @@ async def test_if_fires_on_state_change_legacy(
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_if_fires_on_state_change_with_for( async def test_if_fires_on_state_change_with_for(
hass: HomeAssistant, hass: HomeAssistant,
device_registry: dr.DeviceRegistry, device_registry: dr.DeviceRegistry,
entity_registry: er.EntityRegistry, entity_registry: er.EntityRegistry,
calls: list[ServiceCall], calls: list[ServiceCall],
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test for triggers firing with delay.""" """Test for triggers firing with delay."""
config_entry = MockConfigEntry(domain="test", data={}) config_entry = MockConfigEntry(domain="test", data={})

View File

@ -20,15 +20,16 @@ from tests.common import (
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def entities(hass: HomeAssistant, mock_switch_entities: list[MockSwitch]): def entities(
hass: HomeAssistant, mock_switch_entities: list[MockSwitch]
) -> list[MockSwitch]:
"""Initialize the test switch.""" """Initialize the test switch."""
setup_test_component_platform(hass, switch.DOMAIN, mock_switch_entities) setup_test_component_platform(hass, switch.DOMAIN, mock_switch_entities)
return mock_switch_entities return mock_switch_entities
async def test_methods( @pytest.mark.usefixtures("enable_custom_integrations")
hass: HomeAssistant, entities, enable_custom_integrations: None async def test_methods(hass: HomeAssistant, entities: list[MockSwitch]) -> None:
) -> None:
"""Test is_on, turn_on, turn_off methods.""" """Test is_on, turn_on, turn_off methods."""
switch_1, switch_2, switch_3 = entities switch_1, switch_2, switch_3 = entities
assert await async_setup_component( assert await async_setup_component(
@ -60,11 +61,11 @@ async def test_methods(
assert switch.is_on(hass, switch_3.entity_id) assert switch.is_on(hass, switch_3.entity_id)
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_switch_context( async def test_switch_context(
hass: HomeAssistant, hass: HomeAssistant,
entities, entities,
hass_admin_user: MockUser, hass_admin_user: MockUser,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test that switch context works.""" """Test that switch context works."""
assert await async_setup_component(hass, "switch", {"switch": {"platform": "test"}}) assert await async_setup_component(hass, "switch", {"switch": {"platform": "test"}})

View File

@ -119,6 +119,7 @@ async def _assert_contexts(client, next_id, contexts, domain=None, item_id=None)
("script", "sequence", [set(), set()], [UNDEFINED, UNDEFINED], "id", []), ("script", "sequence", [set(), set()], [UNDEFINED, UNDEFINED], "id", []),
], ],
) )
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_get_trace( async def test_get_trace(
hass: HomeAssistant, hass: HomeAssistant,
hass_storage: dict[str, Any], hass_storage: dict[str, Any],
@ -129,7 +130,6 @@ async def test_get_trace(
trigger, trigger,
context_key, context_key,
condition_results, condition_results,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test tracing a script or automation.""" """Test tracing a script or automation."""
await async_setup_component(hass, "homeassistant", {}) await async_setup_component(hass, "homeassistant", {})
@ -1573,10 +1573,10 @@ async def test_script_mode_2(
assert trace["script_execution"] == "finished" assert trace["script_execution"] == "finished"
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_trace_blueprint_automation( async def test_trace_blueprint_automation(
hass: HomeAssistant, hass: HomeAssistant,
hass_ws_client: WebSocketGenerator, hass_ws_client: WebSocketGenerator,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test trace of blueprint automation.""" """Test trace of blueprint automation."""
await async_setup_component(hass, "homeassistant", {}) await async_setup_component(hass, "homeassistant", {})

View File

@ -249,11 +249,11 @@ async def test_webhook_local_only(hass: HomeAssistant, mock_client) -> None:
assert len(hooks) == 1 assert len(hooks) == 1
@pytest.mark.usefixtures("enable_custom_integrations")
async def test_listing_webhook( async def test_listing_webhook(
hass: HomeAssistant, hass: HomeAssistant,
hass_ws_client: WebSocketGenerator, hass_ws_client: WebSocketGenerator,
hass_access_token: str, hass_access_token: str,
enable_custom_integrations: None,
) -> None: ) -> None:
"""Test unregistering a webhook.""" """Test unregistering a webhook."""
assert await async_setup_component(hass, "webhook", {}) assert await async_setup_component(hass, "webhook", {})