diff --git a/tests/components/device_sun_light_trigger/test_init.py b/tests/components/device_sun_light_trigger/test_init.py index 0c5a9ccab14..6b563f1cb5f 100644 --- a/tests/components/device_sun_light_trigger/test_init.py +++ b/tests/components/device_sun_light_trigger/test_init.py @@ -28,9 +28,11 @@ from tests.common import async_fire_time_changed @pytest.fixture -def scanner(hass, enable_custom_integrations): +async def scanner(hass, enable_custom_integrations): """Initialize components.""" - scanner = getattr(hass.components, "test.device_tracker").get_scanner(None, None) + scanner = await getattr(hass.components, "test.device_tracker").async_get_scanner( + None, None + ) scanner.reset() scanner.come_home("DEV1") @@ -56,19 +58,16 @@ def scanner(hass, enable_custom_integrations): }, }, ): - assert hass.loop.run_until_complete( - async_setup_component( - hass, - device_tracker.DOMAIN, - {device_tracker.DOMAIN: {CONF_PLATFORM: "test"}}, - ) + assert await async_setup_component( + hass, + device_tracker.DOMAIN, + {device_tracker.DOMAIN: {CONF_PLATFORM: "test"}}, ) - assert hass.loop.run_until_complete( - async_setup_component( - hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} - ) + assert await async_setup_component( + hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}} ) + await hass.async_block_till_done() return scanner diff --git a/tests/testing_config/custom_components/test/device_tracker.py b/tests/testing_config/custom_components/test/device_tracker.py index d5f34f48ec8..31294a48e3d 100644 --- a/tests/testing_config/custom_components/test/device_tracker.py +++ b/tests/testing_config/custom_components/test/device_tracker.py @@ -5,7 +5,7 @@ from homeassistant.components.device_tracker.config_entry import ScannerEntity from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER -def get_scanner(hass, config): +async def async_get_scanner(hass, config): """Return a mock scanner.""" return SCANNER