diff --git a/homeassistant/helpers/config_entry_flow.py b/homeassistant/helpers/config_entry_flow.py index c4da43a7061..f2247e533a8 100644 --- a/homeassistant/helpers/config_entry_flow.py +++ b/homeassistant/helpers/config_entry_flow.py @@ -69,8 +69,7 @@ class DiscoveryFlowHandler(config_entries.ConfigFlow, Generic[_R]): if not (has_devices := bool(in_progress)): has_devices = await cast( - "asyncio.Future[bool]", - self.hass.async_add_job(self._discovery_function, self.hass), + "asyncio.Future[bool]", self._discovery_function(self.hass) ) if not has_devices: diff --git a/tests/helpers/test_config_entry_flow.py b/tests/helpers/test_config_entry_flow.py index f59b2163591..0735c0a1a80 100644 --- a/tests/helpers/test_config_entry_flow.py +++ b/tests/helpers/test_config_entry_flow.py @@ -404,6 +404,7 @@ async def test_webhook_create_cloudhook( assert len(mock_delete.mock_calls) == 1 assert result["require_restart"] is False + await hass.async_block_till_done() async def test_webhook_create_cloudhook_aborts_not_connected(