Remove remaining run_immediately=False from tests (#115168)

pull/115170/head
J. Nick Koston 2024-04-07 16:47:41 -10:00 committed by GitHub
parent 9ef28f83ea
commit 3daecc7a31
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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")