mirror of
https://github.com/home-assistant/core.git
synced 2025-07-09 06:17:07 +00:00
Convert device_sun_light_trigger test fixture to async (#89578)
This commit is contained in:
parent
234610b1cc
commit
376a6eb82a
@ -28,9 +28,11 @@ from tests.common import async_fire_time_changed
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def scanner(hass, enable_custom_integrations):
|
async def scanner(hass, enable_custom_integrations):
|
||||||
"""Initialize components."""
|
"""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.reset()
|
||||||
scanner.come_home("DEV1")
|
scanner.come_home("DEV1")
|
||||||
@ -56,19 +58,16 @@ def scanner(hass, enable_custom_integrations):
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
):
|
):
|
||||||
assert hass.loop.run_until_complete(
|
assert await async_setup_component(
|
||||||
async_setup_component(
|
hass,
|
||||||
hass,
|
device_tracker.DOMAIN,
|
||||||
device_tracker.DOMAIN,
|
{device_tracker.DOMAIN: {CONF_PLATFORM: "test"}},
|
||||||
{device_tracker.DOMAIN: {CONF_PLATFORM: "test"}},
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
assert hass.loop.run_until_complete(
|
assert await async_setup_component(
|
||||||
async_setup_component(
|
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
|
||||||
hass, light.DOMAIN, {light.DOMAIN: {CONF_PLATFORM: "test"}}
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
return scanner
|
return scanner
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ from homeassistant.components.device_tracker.config_entry import ScannerEntity
|
|||||||
from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
|
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 a mock scanner."""
|
||||||
return SCANNER
|
return SCANNER
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user