From bc8a52038b77fc3629a046699aac4a8bf5bf24cd Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 12 Feb 2021 08:45:19 -1000 Subject: [PATCH] Fix homekit migration not being awaited (#46460) --- homeassistant/components/homekit/__init__.py | 2 +- tests/components/homekit/test_homekit.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/homekit/__init__.py b/homeassistant/components/homekit/__init__.py index 568804ef081..34044742703 100644 --- a/homeassistant/components/homekit/__init__.py +++ b/homeassistant/components/homekit/__init__.py @@ -240,7 +240,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry): if CONF_ENTRY_INDEX in conf and conf[CONF_ENTRY_INDEX] == 0: _LOGGER.debug("Migrating legacy HomeKit data for %s", name) - hass.async_add_executor_job( + await hass.async_add_executor_job( migrate_filesystem_state_data_for_primary_imported_entry_id, hass, entry.entry_id, diff --git a/tests/components/homekit/test_homekit.py b/tests/components/homekit/test_homekit.py index f0d6a8b365f..1fff55db195 100644 --- a/tests/components/homekit/test_homekit.py +++ b/tests/components/homekit/test_homekit.py @@ -51,7 +51,7 @@ from homeassistant.const import ( CONF_PORT, DEVICE_CLASS_BATTERY, DEVICE_CLASS_HUMIDITY, - EVENT_HOMEASSISTANT_START, + EVENT_HOMEASSISTANT_STARTED, EVENT_HOMEASSISTANT_STOP, PERCENTAGE, SERVICE_RELOAD, @@ -118,7 +118,7 @@ async def test_setup_min(hass, mock_zeroconf): # Test auto start enabled mock_homekit.reset_mock() - hass.bus.async_fire(EVENT_HOMEASSISTANT_START) + hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() mock_homekit().async_start.assert_called() @@ -155,7 +155,7 @@ async def test_setup_auto_start_disabled(hass, mock_zeroconf): # Test auto_start disabled homekit.reset_mock() homekit.async_start.reset_mock() - hass.bus.async_fire(EVENT_HOMEASSISTANT_START) + hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() assert homekit.async_start.called is False @@ -951,7 +951,7 @@ async def test_setup_imported(hass, mock_zeroconf): # Test auto start enabled mock_homekit.reset_mock() - hass.bus.async_fire(EVENT_HOMEASSISTANT_START) + hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() mock_homekit().async_start.assert_called() @@ -1005,7 +1005,7 @@ async def test_yaml_updates_update_config_entry_for_name(hass, mock_zeroconf): # Test auto start enabled mock_homekit.reset_mock() - hass.bus.async_fire(EVENT_HOMEASSISTANT_START) + hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() mock_homekit().async_start.assert_called()