mirror of
https://github.com/home-assistant/core.git
synced 2026-12-04 12:50:45 -04:00
Fix flaky WiZ reconfigure test (#189393)
This commit is contained in:
@@ -326,7 +326,8 @@ async def async_setup_integration(
|
||||
bulb = wizlight or _mocked_wizlight(device, extended_white_range, bulb_type)
|
||||
with _patch_discovery(), _patch_wizlight(device=bulb):
|
||||
await async_setup_component(hass, DOMAIN, {DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
# Let the discovery started by async_setup finish while it is patched.
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
return bulb, entry
|
||||
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ async def test_wrong_device_now_has_our_ip(hass: HomeAssistant) -> None:
|
||||
bulb.mac = "dddddddddddd"
|
||||
_, entry = await async_setup_integration(hass, wizlight=bulb)
|
||||
assert entry.state is ConfigEntryState.SETUP_RETRY
|
||||
# Each retry creates a new bulb, so the socket of this one must not leak
|
||||
bulb.async_close.assert_called_once()
|
||||
# Each retry creates a new bulb, so every attempt must close its socket
|
||||
assert bulb.async_close.call_count == bulb.getMac.call_count
|
||||
|
||||
with _patch_wizlight():
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
Reference in New Issue
Block a user