Skip to content

Commit a35af90

Browse files
authored
Remove uneeded async_setup_component from trigger/condition tests (home-assistant#157873)
1 parent 710b7c2 commit a35af90

File tree

12 files changed

+0
-78
lines changed

12 files changed

+0
-78
lines changed

tests/components/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ async def target_entities(
3838
- included: List of entity_ids meant to be targeted.
3939
- excluded: List of entity_ids not meant to be targeted.
4040
"""
41-
await async_setup_component(hass, domain, {})
42-
4341
config_entry = MockConfigEntry(domain="test")
4442
config_entry.add_to_hass(hass)
4543

tests/components/alarm_control_panel/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
)
1212
from homeassistant.const import ATTR_LABEL_ID, ATTR_SUPPORTED_FEATURES, CONF_ENTITY_ID
1313
from homeassistant.core import HomeAssistant, ServiceCall
14-
from homeassistant.setup import async_setup_component
1514

1615
from tests.components import (
1716
StateDescription,
@@ -154,8 +153,6 @@ async def test_alarm_control_panel_state_trigger_behavior_any(
154153
states: list[StateDescription],
155154
) -> None:
156155
"""Test that the alarm control panel state trigger fires when any alarm control panel state changes to a specific state."""
157-
await async_setup_component(hass, "alarm_control_panel", {})
158-
159156
other_entity_ids = set(target_alarm_control_panels) - {entity_id}
160157

161158
# Set all alarm control panels, including the tested one, to the initial state
@@ -266,8 +263,6 @@ async def test_alarm_control_panel_state_trigger_behavior_first(
266263
states: list[StateDescription],
267264
) -> None:
268265
"""Test that the alarm control panel state trigger fires when the first alarm control panel changes to a specific state."""
269-
await async_setup_component(hass, "alarm_control_panel", {})
270-
271266
other_entity_ids = set(target_alarm_control_panels) - {entity_id}
272267

273268
# Set all alarm control panels, including the tested one, to the initial state
@@ -377,8 +372,6 @@ async def test_alarm_control_panel_state_trigger_behavior_last(
377372
states: list[StateDescription],
378373
) -> None:
379374
"""Test that the alarm_control_panel state trigger fires when the last alarm_control_panel changes to a specific state."""
380-
await async_setup_component(hass, "alarm_control_panel", {})
381-
382375
other_entity_ids = set(target_alarm_control_panels) - {entity_id}
383376

384377
# Set all alarm control panels, including the tested one, to the initial state

tests/components/assist_satellite/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from homeassistant.components.assist_satellite.entity import AssistSatelliteState
99
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID
1010
from homeassistant.core import HomeAssistant, ServiceCall
11-
from homeassistant.setup import async_setup_component
1211

1312
from tests.components import (
1413
StateDescription,
@@ -105,8 +104,6 @@ async def test_assist_satellite_state_trigger_behavior_any(
105104
states: list[StateDescription],
106105
) -> None:
107106
"""Test that the assist satellite state trigger fires when any assist satellite state changes to a specific state."""
108-
await async_setup_component(hass, "assist_satellite", {})
109-
110107
other_entity_ids = set(target_assist_satellites) - {entity_id}
111108

112109
# Set all assist satellites, including the tested one, to the initial state
@@ -174,8 +171,6 @@ async def test_assist_satellite_state_trigger_behavior_first(
174171
states: list[StateDescription],
175172
) -> None:
176173
"""Test that the assist satellite state trigger fires when the first assist satellite changes to a specific state."""
177-
await async_setup_component(hass, "assist_satellite", {})
178-
179174
other_entity_ids = set(target_assist_satellites) - {entity_id}
180175

181176
# Set all assist satellites, including the tested one, to the initial state
@@ -242,8 +237,6 @@ async def test_assist_satellite_state_trigger_behavior_last(
242237
states: list[StateDescription],
243238
) -> None:
244239
"""Test that the assist_satellite state trigger fires when the last assist_satellite changes to a specific state."""
245-
await async_setup_component(hass, "assist_satellite", {})
246-
247240
other_entity_ids = set(target_assist_satellites) - {entity_id}
248241

249242
# Set all assist satellites, including the tested one, to the initial state

tests/components/binary_sensor/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
STATE_ON,
1414
)
1515
from homeassistant.core import HomeAssistant, ServiceCall
16-
from homeassistant.setup import async_setup_component
1716

1817
from tests.components import (
1918
StateDescription,
@@ -101,8 +100,6 @@ async def test_binary_sensor_state_attribute_trigger_behavior_any(
101100
states: list[StateDescription],
102101
) -> None:
103102
"""Test that the binary sensor state trigger fires when any binary sensor state changes to a specific state."""
104-
await async_setup_component(hass, "binary_sensor", {})
105-
106103
other_entity_ids = set(target_binary_sensors["included"]) - {entity_id}
107104
excluded_entity_ids = set(target_binary_sensors["excluded"]) - {entity_id}
108105

@@ -172,8 +169,6 @@ async def test_binary_sensor_state_attribute_trigger_behavior_first(
172169
states: list[StateDescription],
173170
) -> None:
174171
"""Test that the binary sensor state trigger fires when the first binary sensor state changes to a specific state."""
175-
await async_setup_component(hass, "binary_sensor", {})
176-
177172
other_entity_ids = set(target_binary_sensors["included"]) - {entity_id}
178173
excluded_entity_ids = set(target_binary_sensors["excluded"]) - {entity_id}
179174

@@ -242,8 +237,6 @@ async def test_binary_sensor_state_attribute_trigger_behavior_last(
242237
states: list[StateDescription],
243238
) -> None:
244239
"""Test that the binary sensor state trigger fires when the last binary sensor state changes to a specific state."""
245-
await async_setup_component(hass, "binary_sensor", {})
246-
247240
other_entity_ids = set(target_binary_sensors["included"]) - {entity_id}
248241
excluded_entity_ids = set(target_binary_sensors["excluded"]) - {entity_id}
249242

tests/components/climate/test_trigger.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
)
1313
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID
1414
from homeassistant.core import HomeAssistant, ServiceCall
15-
from homeassistant.setup import async_setup_component
1615

1716
from tests.components import (
1817
StateDescription,
@@ -107,8 +106,6 @@ async def test_climate_state_trigger_behavior_any(
107106
states: list[StateDescription],
108107
) -> None:
109108
"""Test that the climate state trigger fires when any climate state changes to a specific state."""
110-
await async_setup_component(hass, "climate", {})
111-
112109
other_entity_ids = set(target_climates) - {entity_id}
113110

114111
# Set all climates, including the tested climate, to the initial state
@@ -171,8 +168,6 @@ async def test_climate_state_attribute_trigger_behavior_any(
171168
states: list[StateDescription],
172169
) -> None:
173170
"""Test that the climate state trigger fires when any climate state changes to a specific state."""
174-
await async_setup_component(hass, "climate", {})
175-
176171
other_entity_ids = set(target_climates) - {entity_id}
177172

178173
# Set all climates, including the tested climate, to the initial state
@@ -239,8 +234,6 @@ async def test_climate_state_trigger_behavior_first(
239234
states: list[StateDescription],
240235
) -> None:
241236
"""Test that the climate state trigger fires when the first climate changes to a specific state."""
242-
await async_setup_component(hass, "climate", {})
243-
244237
other_entity_ids = set(target_climates) - {entity_id}
245238

246239
# Set all climates, including the tested climate, to the initial state
@@ -302,8 +295,6 @@ async def test_climate_state_attribute_trigger_behavior_first(
302295
states: list[tuple[tuple[str, dict], int]],
303296
) -> None:
304297
"""Test that the climate state trigger fires when any climate state changes to a specific state."""
305-
await async_setup_component(hass, "climate", {})
306-
307298
other_entity_ids = set(target_climates) - {entity_id}
308299

309300
# Set all climates, including the tested climate, to the initial state
@@ -369,8 +360,6 @@ async def test_climate_state_trigger_behavior_last(
369360
states: list[StateDescription],
370361
) -> None:
371362
"""Test that the climate state trigger fires when the last climate changes to a specific state."""
372-
await async_setup_component(hass, "climate", {})
373-
374363
other_entity_ids = set(target_climates) - {entity_id}
375364

376365
# Set all climates, including the tested climate, to the initial state
@@ -431,8 +420,6 @@ async def test_climate_state_attribute_trigger_behavior_last(
431420
states: list[tuple[tuple[str, dict], int]],
432421
) -> None:
433422
"""Test that the climate state trigger fires when any climate state changes to a specific state."""
434-
await async_setup_component(hass, "climate", {})
435-
436423
other_entity_ids = set(target_climates) - {entity_id}
437424

438425
# Set all climates, including the tested climate, to the initial state

tests/components/fan/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID, STATE_OFF, STATE_ON
99
from homeassistant.core import HomeAssistant, ServiceCall
10-
from homeassistant.setup import async_setup_component
1110

1211
from tests.components import (
1312
StateDescription,
@@ -91,8 +90,6 @@ async def test_fan_state_trigger_behavior_any(
9190
states: list[StateDescription],
9291
) -> None:
9392
"""Test that the fan state trigger fires when any fan state changes to a specific state."""
94-
await async_setup_component(hass, "fan", {})
95-
9693
other_entity_ids = set(target_fans) - {entity_id}
9794

9895
# Set all fans, including the tested fan, to the initial state
@@ -150,8 +147,6 @@ async def test_fan_state_trigger_behavior_first(
150147
states: list[StateDescription],
151148
) -> None:
152149
"""Test that the fan state trigger fires when the first fan changes to a specific state."""
153-
await async_setup_component(hass, "fan", {})
154-
155150
other_entity_ids = set(target_fans) - {entity_id}
156151

157152
# Set all fans, including the tested fan, to the initial state
@@ -208,8 +203,6 @@ async def test_fan_state_trigger_behavior_last(
208203
states: list[StateDescription],
209204
) -> None:
210205
"""Test that the fan state trigger fires when the last fan changes to a specific state."""
211-
await async_setup_component(hass, "fan", {})
212-
213206
other_entity_ids = set(target_fans) - {entity_id}
214207

215208
# Set all fans, including the tested fan, to the initial state

tests/components/lawn_mower/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from homeassistant.components.lawn_mower import LawnMowerActivity
99
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID
1010
from homeassistant.core import HomeAssistant, ServiceCall
11-
from homeassistant.setup import async_setup_component
1211

1312
from tests.components import (
1413
StateDescription,
@@ -105,8 +104,6 @@ async def test_lawn_mower_state_trigger_behavior_any(
105104
states: list[StateDescription],
106105
) -> None:
107106
"""Test that the lawn mower state trigger fires when any lawn mower state changes to a specific state."""
108-
await async_setup_component(hass, "lawn_mower", {})
109-
110107
other_entity_ids = set(target_lawn_mowers) - {entity_id}
111108

112109
# Set all lawn mowers, including the tested one, to the initial state
@@ -174,8 +171,6 @@ async def test_lawn_mower_state_trigger_behavior_first(
174171
states: list[StateDescription],
175172
) -> None:
176173
"""Test that the lawn mower state trigger fires when the first lawn mower changes to a specific state."""
177-
await async_setup_component(hass, "lawn_mower", {})
178-
179174
other_entity_ids = set(target_lawn_mowers) - {entity_id}
180175

181176
# Set all lawn mowers, including the tested one, to the initial state
@@ -242,8 +237,6 @@ async def test_lawn_mower_state_trigger_behavior_last(
242237
states: list[StateDescription],
243238
) -> None:
244239
"""Test that the lawn_mower state trigger fires when the last lawn_mower changes to a specific state."""
245-
await async_setup_component(hass, "lawn_mower", {})
246-
247240
other_entity_ids = set(target_lawn_mowers) - {entity_id}
248241

249242
# Set all lawn mowers, including the tested one, to the initial state

tests/components/light/test_condition.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ async def test_light_state_condition_behavior_any(
152152
other_state: str,
153153
) -> None:
154154
"""Test the light state condition with the 'any' behavior."""
155-
await async_setup_component(hass, "light", {})
156-
157155
other_entity_ids = set(target_lights) - {entity_id}
158156

159157
# Set all lights, including the tested light, to the initial state
@@ -235,8 +233,6 @@ async def test_light_state_condition_behavior_all(
235233
other_state: str,
236234
) -> None:
237235
"""Test the light state condition with the 'all' behavior."""
238-
await async_setup_component(hass, "light", {})
239-
240236
# Set state for two switches to ensure that they don't impact the condition
241237
hass.states.async_set("switch.label_switch_1", STATE_OFF)
242238
hass.states.async_set("switch.label_switch_2", STATE_ON)

tests/components/light/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID, STATE_OFF, STATE_ON
99
from homeassistant.core import HomeAssistant, ServiceCall
10-
from homeassistant.setup import async_setup_component
1110

1211
from tests.components import (
1312
StateDescription,
@@ -91,8 +90,6 @@ async def test_light_state_trigger_behavior_any(
9190
states: list[StateDescription],
9291
) -> None:
9392
"""Test that the light state trigger fires when any light state changes to a specific state."""
94-
await async_setup_component(hass, "light", {})
95-
9693
other_entity_ids = set(target_lights) - {entity_id}
9794

9895
# Set all lights, including the tested light, to the initial state
@@ -150,8 +147,6 @@ async def test_light_state_trigger_behavior_first(
150147
states: list[StateDescription],
151148
) -> None:
152149
"""Test that the light state trigger fires when the first light changes to a specific state."""
153-
await async_setup_component(hass, "light", {})
154-
155150
other_entity_ids = set(target_lights) - {entity_id}
156151

157152
# Set all lights, including the tested light, to the initial state
@@ -208,8 +203,6 @@ async def test_light_state_trigger_behavior_last(
208203
states: list[StateDescription],
209204
) -> None:
210205
"""Test that the light state trigger fires when the last light changes to a specific state."""
211-
await async_setup_component(hass, "light", {})
212-
213206
other_entity_ids = set(target_lights) - {entity_id}
214207

215208
# Set all lights, including the tested light, to the initial state

tests/components/media_player/test_trigger.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from homeassistant.components.media_player import MediaPlayerState
99
from homeassistant.const import ATTR_LABEL_ID, CONF_ENTITY_ID
1010
from homeassistant.core import HomeAssistant, ServiceCall
11-
from homeassistant.setup import async_setup_component
1211

1312
from tests.components import (
1413
StateDescription,
@@ -94,8 +93,6 @@ async def test_media_player_state_trigger_behavior_any(
9493
states: list[StateDescription],
9594
) -> None:
9695
"""Test that the media player state trigger fires when any media player state changes to a specific state."""
97-
await async_setup_component(hass, "media_player", {})
98-
9996
other_entity_ids = set(target_media_players) - {entity_id}
10097

10198
# Set all media players, including the tested media player, to the initial state
@@ -156,8 +153,6 @@ async def test_media_player_state_trigger_behavior_first(
156153
states: list[StateDescription],
157154
) -> None:
158155
"""Test that the media player state trigger fires when the first media player changes to a specific state."""
159-
await async_setup_component(hass, "media_player", {})
160-
161156
other_entity_ids = set(target_media_players) - {entity_id}
162157

163158
# Set all media players, including the tested media player, to the initial state
@@ -217,8 +212,6 @@ async def test_media_player_state_trigger_behavior_last(
217212
states: list[StateDescription],
218213
) -> None:
219214
"""Test that the media player state trigger fires when the last media player changes to a specific state."""
220-
await async_setup_component(hass, "media_player", {})
221-
222215
other_entity_ids = set(target_media_players) - {entity_id}
223216

224217
# Set all media players, including the tested media player, to the initial state

0 commit comments

Comments
 (0)