Switch to asyncio.wait for slow update warning implementation (#41184)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2020-10-05 15:28:15 +02:00
1 parent dde465da48
commit f50976a0b3
9 files changed
+62 -45

No files matched your search

+1
View File
@@ -494,6 +494,7 @@ async def test_is_opening_closing(hass, setup_comp):
await hass.services.async_call(
DOMAIN, SERVICE_OPEN_COVER, {ATTR_ENTITY_ID: COVER_GROUP}, blocking=True
)
await hass.async_block_till_done()
assert hass.states.get(DEMO_COVER_POS).state == STATE_OPENING
assert hass.states.get(DEMO_COVER_TILT).state == STATE_OPENING
@@ -120,6 +120,7 @@ async def test_updates_from_signals(hass, config_entry, config, controller, favo
const.SIGNAL_PLAYER_EVENT, player.player_id, const.EVENT_PLAYER_STATE_CHANGED
)
await hass.async_block_till_done()
state = hass.states.get("media_player.test_player")
assert state.state == STATE_PLAYING
@@ -227,6 +228,7 @@ async def test_updates_from_players_changed(
const.SIGNAL_CONTROLLER_EVENT, const.EVENT_PLAYERS_CHANGED, change_data
)
await event.wait()
await hass.async_block_till_done()
assert hass.states.get("media_player.test_player").state == STATE_PLAYING
@@ -112,6 +112,7 @@ async def test_if_fires_on_state_change(hass, calls, kodi_media_player):
]
},
)
await hass.async_block_till_done()
await hass.services.async_call(
MP_DOMAIN,
@@ -140,6 +140,8 @@ async def _goto_future(hass, future=None):
with patch("homeassistant.util.utcnow", return_value=future):
async_fire_time_changed(hass, future)
await hass.async_block_till_done()
async_fire_time_changed(hass, future)
await hass.async_block_till_done()
async def test_full_valid_config(hass):
@@ -247,6 +249,8 @@ async def test_delivered_not_shown(hass):
hass.components.persistent_notification = MagicMock()
await _setup_seventeentrack(hass, VALID_CONFIG_FULL_NO_DELIVERED)
await _goto_future(hass)
assert not hass.states.async_entity_ids()
hass.components.persistent_notification.create.assert_called()
@@ -45,6 +45,7 @@ async def test_update_failure(hass, config_entry, aioclient_mock):
"""Test that the coordinator handles a bad response."""
await setup_integration(hass, config_entry, aioclient_mock, bad_reading=True)
await async_setup_component(hass, HA_DOMAIN, {})
await hass.async_block_till_done()
with patch("smart_meter_texas.Meter.read_meter") as updater:
await hass.services.async_call(
HA_DOMAIN,
+3
View File
@@ -56,6 +56,7 @@ async def test_light_service_calls(hass):
assert hass.states.get("light.light_switch").state == "on"
await common.async_turn_off(hass, "light.light_switch")
await hass.async_block_till_done()
assert hass.states.get("switch.decorative_lights").state == "off"
assert hass.states.get("light.light_switch").state == "off"
@@ -74,11 +75,13 @@ async def test_switch_service_calls(hass):
assert hass.states.get("light.light_switch").state == "on"
await switch_common.async_turn_off(hass, "switch.decorative_lights")
await hass.async_block_till_done()
assert hass.states.get("switch.decorative_lights").state == "off"
assert hass.states.get("light.light_switch").state == "off"
await switch_common.async_turn_on(hass, "switch.decorative_lights")
await hass.async_block_till_done()
assert hass.states.get("switch.decorative_lights").state == "on"
assert hass.states.get("light.light_switch").state == "on"