Fix flaky WiZ reconfigure test (#189393)

This commit is contained in:
Erwin Douna
2026-10-29 08:51:19 +01:00
committed by GitHub
parent 485e815664
commit 5bcfe0185b
2 changed files with 4 additions and 3 deletions
+2 -1
View File
@@ -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
+2 -2
View File
@@ -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)