From 1e3822bdd7744a0193b24fd805487319ae08989a Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Thu, 2 Jan 2020 21:22:49 +0100 Subject: [PATCH] Migrate group tests from coroutine to async/await (#30389) --- tests/components/group/test_init.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/components/group/test_init.py b/tests/components/group/test_init.py index 5c826dbe85d..ee52a551cb8 100644 --- a/tests/components/group/test_init.py +++ b/tests/components/group/test_init.py @@ -1,6 +1,5 @@ """The tests for the Group components.""" # pylint: disable=protected-access -import asyncio from collections import OrderedDict import unittest from unittest.mock import patch @@ -481,25 +480,23 @@ class TestComponentsGroup(unittest.TestCase): assert group_state.attributes.get(ATTR_FRIENDLY_NAME) == "friendly_name" -@asyncio.coroutine -def test_service_group_services(hass): +async def test_service_group_services(hass): """Check if service are available.""" with assert_setup_component(0, "group"): - yield from async_setup_component(hass, "group", {"group": {}}) + await async_setup_component(hass, "group", {"group": {}}) assert hass.services.has_service("group", group.SERVICE_SET) assert hass.services.has_service("group", group.SERVICE_REMOVE) # pylint: disable=invalid-name -@asyncio.coroutine -def test_service_group_set_group_remove_group(hass): +async def test_service_group_set_group_remove_group(hass): """Check if service are available.""" with assert_setup_component(0, "group"): - yield from async_setup_component(hass, "group", {"group": {}}) + await async_setup_component(hass, "group", {"group": {}}) common.async_set_group(hass, "user_test_group", name="Test") - yield from hass.async_block_till_done() + await hass.async_block_till_done() group_state = hass.states.get("group.user_test_group") assert group_state @@ -513,7 +510,7 @@ def test_service_group_set_group_remove_group(hass): visible=False, entity_ids=["test.entity_bla1"], ) - yield from hass.async_block_till_done() + await hass.async_block_till_done() group_state = hass.states.get("group.user_test_group") assert group_state @@ -531,7 +528,7 @@ def test_service_group_set_group_remove_group(hass): control="hidden", add=["test.entity_id2"], ) - yield from hass.async_block_till_done() + await hass.async_block_till_done() group_state = hass.states.get("group.user_test_group") assert group_state @@ -546,7 +543,7 @@ def test_service_group_set_group_remove_group(hass): ) common.async_remove(hass, "user_test_group") - yield from hass.async_block_till_done() + await hass.async_block_till_done() group_state = hass.states.get("group.user_test_group") assert group_state is None