mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 06:47:09 +00:00
Wait for background tasks in Shelly tests (#119636)
This commit is contained in:
parent
72c6257131
commit
40b98b70b0
@ -1125,7 +1125,7 @@ async def test_zeroconf_sleeping_device_not_triggers_refresh(
|
||||
await hass.async_block_till_done()
|
||||
|
||||
mock_rpc_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert "online, resuming setup" in caplog.text
|
||||
assert len(mock_rpc_device.initialize.mock_calls) == 1
|
||||
|
@ -352,7 +352,7 @@ async def test_block_button_click_event(
|
||||
|
||||
# Make device online
|
||||
mock_block_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
device = dr.async_entries_for_config_entry(device_registry, entry.entry_id)[0]
|
||||
|
||||
|
@ -263,7 +263,7 @@ async def test_sleeping_block_device_online(
|
||||
assert "will resume when device is online" in caplog.text
|
||||
|
||||
mock_block_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert "online, resuming setup" in caplog.text
|
||||
assert entry.data["sleep_period"] == device_sleep
|
||||
@ -284,7 +284,7 @@ async def test_sleeping_rpc_device_online(
|
||||
assert "will resume when device is online" in caplog.text
|
||||
|
||||
mock_rpc_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert "online, resuming setup" in caplog.text
|
||||
assert entry.data["sleep_period"] == device_sleep
|
||||
@ -302,7 +302,7 @@ async def test_sleeping_rpc_device_online_new_firmware(
|
||||
|
||||
mutate_rpc_device_status(monkeypatch, mock_rpc_device, "sys", "wakeup_period", 1500)
|
||||
mock_rpc_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
assert "online, resuming setup" in caplog.text
|
||||
assert entry.data["sleep_period"] == 1500
|
||||
|
@ -188,7 +188,7 @@ async def test_block_set_value_connection_error(
|
||||
|
||||
# Make device online
|
||||
mock_block_device.mock_online()
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done(wait_background_tasks=True)
|
||||
|
||||
with pytest.raises(HomeAssistantError):
|
||||
await hass.services.async_call(
|
||||
|
Loading…
x
Reference in New Issue
Block a user