Remove remaining run_immediately=False from tests (#115168)
parent
9ef28f83ea
commit
3daecc7a31
|
@ -353,13 +353,13 @@ async def async_test_home_assistant(
|
|||
|
||||
hass.set_state(CoreState.running)
|
||||
|
||||
@callback
|
||||
def clear_instance(event):
|
||||
async def clear_instance(event):
|
||||
"""Clear global instance."""
|
||||
await asyncio.sleep(0) # Give aiohttp one loop iteration to close
|
||||
INSTANCES.remove(hass)
|
||||
|
||||
hass.bus.async_listen_once(
|
||||
EVENT_HOMEASSISTANT_CLOSE, clear_instance, run_immediately=False
|
||||
EVENT_HOMEASSISTANT_CLOSE, clear_instance, run_immediately=True
|
||||
)
|
||||
|
||||
yield hass
|
||||
|
|
|
@ -2506,6 +2506,7 @@ async def test_recursive_automation_starting_script(
|
|||
async def async_automation_triggered(event):
|
||||
"""Listen to automation_triggered event from the automation integration."""
|
||||
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.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
|
||||
)
|
||||
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")
|
||||
|
|
Loading…
Reference in New Issue