mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Remove remaining run_immediately=False from tests (#115168)
This commit is contained in:
parent
9ef28f83ea
commit
3daecc7a31
@ -353,13 +353,13 @@ async def async_test_home_assistant(
|
|||||||
|
|
||||||
hass.set_state(CoreState.running)
|
hass.set_state(CoreState.running)
|
||||||
|
|
||||||
@callback
|
async def clear_instance(event):
|
||||||
def clear_instance(event):
|
|
||||||
"""Clear global instance."""
|
"""Clear global instance."""
|
||||||
|
await asyncio.sleep(0) # Give aiohttp one loop iteration to close
|
||||||
INSTANCES.remove(hass)
|
INSTANCES.remove(hass)
|
||||||
|
|
||||||
hass.bus.async_listen_once(
|
hass.bus.async_listen_once(
|
||||||
EVENT_HOMEASSISTANT_CLOSE, clear_instance, run_immediately=False
|
EVENT_HOMEASSISTANT_CLOSE, clear_instance, run_immediately=True
|
||||||
)
|
)
|
||||||
|
|
||||||
yield hass
|
yield hass
|
||||||
|
@ -2506,6 +2506,7 @@ async def test_recursive_automation_starting_script(
|
|||||||
async def async_automation_triggered(event):
|
async def async_automation_triggered(event):
|
||||||
"""Listen to automation_triggered event from the automation integration."""
|
"""Listen to automation_triggered event from the automation integration."""
|
||||||
automation_triggered.append(event)
|
automation_triggered.append(event)
|
||||||
|
await asyncio.sleep(0) # Yield to allow other tasks to run
|
||||||
hass.states.async_set("sensor.test", str(len(automation_triggered)))
|
hass.states.async_set("sensor.test", str(len(automation_triggered)))
|
||||||
|
|
||||||
hass.services.async_register("test", "script_done", async_service_handler)
|
hass.services.async_register("test", "script_done", async_service_handler)
|
||||||
@ -2513,7 +2514,7 @@ async def test_recursive_automation_starting_script(
|
|||||||
"test", "automation_started", async_service_handler
|
"test", "automation_started", async_service_handler
|
||||||
)
|
)
|
||||||
hass.bus.async_listen(
|
hass.bus.async_listen(
|
||||||
"automation_triggered", async_automation_triggered, run_immediately=False
|
"automation_triggered", async_automation_triggered, run_immediately=True
|
||||||
)
|
)
|
||||||
|
|
||||||
hass.bus.async_fire("trigger_automation")
|
hass.bus.async_fire("trigger_automation")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user