1
0
mirror of https://github.com/home-assistant/core.git synced 2026-04-26 03:39:31 +01:00

Refactor async_call_later to improve performance and reduce conversion loss (#87117)

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
krahabb
2023-02-05 19:04:38 +01:00
committed by GitHub
parent 936ffafd27
commit 899342d391
6 changed files with 117 additions and 66 deletions

View File

@@ -186,14 +186,14 @@ async def test_platform_not_ready(hass):
component = EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_setup({DOMAIN: {"platform": "mod1"}})
await hass.async_block_till_done()
assert len(platform1_setup.mock_calls) == 1
assert "test_domain.mod1" not in hass.config.components
utcnow = dt_util.utcnow()
with freeze_time(utcnow):
await component.async_setup({DOMAIN: {"platform": "mod1"}})
await hass.async_block_till_done()
assert len(platform1_setup.mock_calls) == 1
assert "test_domain.mod1" not in hass.config.components
# Should not trigger attempt 2
async_fire_time_changed(hass, utcnow + timedelta(seconds=29))
await hass.async_block_till_done()