From d7175b47d5a1c933ba9e3719ebf488a80a0709f8 Mon Sep 17 00:00:00 2001 From: Xavier Moreno Date: Mon, 5 Jul 2021 20:10:12 +0200 Subject: [PATCH] refactor(tests): wrap_execution: change name because of a typo --- tests/test_utils.py | 2 +- tests/unit_tests/cx_core/color_helper_test.py | 4 ++-- tests/unit_tests/cx_core/controller_test.py | 10 +++++----- tests/unit_tests/cx_core/integration/deconz_test.py | 4 ++-- tests/unit_tests/cx_core/integration/z2m_test.py | 4 ++-- tests/unit_tests/cx_core/type/cover_controller_test.py | 4 ++-- tests/unit_tests/cx_core/type/light_controller_test.py | 8 ++++---- tests/unit_tests/cx_core/type_controller_test.py | 8 ++++---- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 59f42c5d..0c640149 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -71,7 +71,7 @@ def get_classes(file_, package_, class_, instantiate=False): @contextmanager -def wrap_exetuction( +def wrap_execution( *, error_expected: bool, exception=Exception ) -> Generator[Optional[ExceptionInfo], None, None]: if error_expected: diff --git a/tests/unit_tests/cx_core/color_helper_test.py b/tests/unit_tests/cx_core/color_helper_test.py index be200663..e71fd71c 100644 --- a/tests/unit_tests/cx_core/color_helper_test.py +++ b/tests/unit_tests/cx_core/color_helper_test.py @@ -1,7 +1,7 @@ import pytest from cx_core.color_helper import Colors, get_color_wheel -from tests.test_utils import wrap_exetuction +from tests.test_utils import wrap_execution @pytest.mark.parametrize( @@ -14,5 +14,5 @@ ], ) def test_get_color_wheel(colors: Colors, error_expected: bool): - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): colors = get_color_wheel(colors) diff --git a/tests/unit_tests/cx_core/controller_test.py b/tests/unit_tests/cx_core/controller_test.py index d4a45c80..53df0f41 100644 --- a/tests/unit_tests/cx_core/controller_test.py +++ b/tests/unit_tests/cx_core/controller_test.py @@ -10,7 +10,7 @@ from cx_core.controller import Controller, action from pytest_mock.plugin import MockerFixture -from tests.test_utils import IntegrationMock, fake_fn, wrap_exetuction +from tests.test_utils import IntegrationMock, fake_fn, wrap_execution INTEGRATION_TEST_NAME = "test" CONTROLLER_NAME = "test_controller" @@ -164,7 +164,7 @@ async def test_initialize( ) # SUT - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): await sut_before_init.initialize() # Checks @@ -214,7 +214,7 @@ async def test_merge_mapping( ) # SUT - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): await sut_before_init.initialize() # Checks @@ -332,7 +332,7 @@ def test_get_multiple_click_actions( def test_get_option( sut: Controller, option: str, options: List[str], error_expected: bool ): - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): sut.get_option(option, options) @@ -361,7 +361,7 @@ def test_get_integration( ): get_integrations_spy = mocker.spy(integration_module, "get_integrations") - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): integration = fake_controller.get_integration(integration_input) if not error_expected: diff --git a/tests/unit_tests/cx_core/integration/deconz_test.py b/tests/unit_tests/cx_core/integration/deconz_test.py index 2f02264c..5eefeb6a 100644 --- a/tests/unit_tests/cx_core/integration/deconz_test.py +++ b/tests/unit_tests/cx_core/integration/deconz_test.py @@ -6,7 +6,7 @@ from cx_core.integration.deconz import DeCONZIntegration from pytest_mock.plugin import MockerFixture -from tests.test_utils import wrap_exetuction +from tests.test_utils import wrap_execution @pytest.mark.parametrize( @@ -64,7 +64,7 @@ async def test_listen_changes( listen_event_mock = mocker.patch.object(Hass, "listen_event") deconz_integration = DeCONZIntegration(fake_controller, kwargs) - with wrap_exetuction(error_expected=expected_id is None, exception=ValueError): + with wrap_execution(error_expected=expected_id is None, exception=ValueError): await deconz_integration.listen_changes("controller_id") if expected_id is not None: diff --git a/tests/unit_tests/cx_core/integration/z2m_test.py b/tests/unit_tests/cx_core/integration/z2m_test.py index 7e47991a..553ca3f1 100644 --- a/tests/unit_tests/cx_core/integration/z2m_test.py +++ b/tests/unit_tests/cx_core/integration/z2m_test.py @@ -8,7 +8,7 @@ from cx_core.integration.z2m import Z2MIntegration from pytest_mock import MockerFixture -from tests.test_utils import wrap_exetuction +from tests.test_utils import wrap_execution @pytest.mark.parametrize( @@ -90,7 +90,7 @@ async def test_listen_changes( mqtt_listen_event_mock = mocker.patch.object(Mqtt, "listen_event") z2m_integration = Z2MIntegration(fake_controller, kwargs) - with wrap_exetuction(error_expected=expected_id is None, exception=ValueError): + with wrap_execution(error_expected=expected_id is None, exception=ValueError): await z2m_integration.listen_changes("controller_id") if expected_id is None: diff --git a/tests/unit_tests/cx_core/type/cover_controller_test.py b/tests/unit_tests/cx_core/type/cover_controller_test.py index a06a94f7..95883f03 100644 --- a/tests/unit_tests/cx_core/type/cover_controller_test.py +++ b/tests/unit_tests/cx_core/type/cover_controller_test.py @@ -8,7 +8,7 @@ from cx_core.type_controller import TypeController from pytest_mock.plugin import MockerFixture -from tests.test_utils import fake_fn, wrap_exetuction +from tests.test_utils import fake_fn, wrap_execution ENTITY_NAME = "cover.test" @@ -53,7 +53,7 @@ async def test_init( "close_position": close_position, } - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): await sut_before_init.init() if not error_expected: diff --git a/tests/unit_tests/cx_core/type/light_controller_test.py b/tests/unit_tests/cx_core/type/light_controller_test.py index 0b09e02b..7b73aa24 100644 --- a/tests/unit_tests/cx_core/type/light_controller_test.py +++ b/tests/unit_tests/cx_core/type/light_controller_test.py @@ -12,7 +12,7 @@ from pytest_mock.plugin import MockerFixture from typing_extensions import Literal -from tests.test_utils import fake_fn, wrap_exetuction +from tests.test_utils import fake_fn, wrap_execution ENTITY_NAME = "light.test" @@ -72,7 +72,7 @@ async def test_init( sut_before_init.args["light"] = light_input # SUT - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): await sut_before_init.init() # Checks @@ -124,7 +124,7 @@ async def test_get_attribute( sut.feature_support._supported_features = supported_features sut.entity = LightEntity(name=ENTITY_NAME, color_mode=color_mode) - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): output = await sut.get_attribute(attribute_input) if not error_expected: @@ -167,7 +167,7 @@ async def fake_get_entity_state(entity, attribute=None): monkeypatch.setattr(sut, "get_entity_state", fake_get_entity_state) - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): output = await sut.get_value_attribute(attribute_input) if not error_expected: diff --git a/tests/unit_tests/cx_core/type_controller_test.py b/tests/unit_tests/cx_core/type_controller_test.py index 385edf2e..887a9cf3 100644 --- a/tests/unit_tests/cx_core/type_controller_test.py +++ b/tests/unit_tests/cx_core/type_controller_test.py @@ -6,7 +6,7 @@ from cx_core.type_controller import Entity, TypeController from pytest_mock.plugin import MockerFixture -from tests.test_utils import fake_fn, wrap_exetuction +from tests.test_utils import fake_fn, wrap_execution ENTITY_ARG = "my_entity" ENTITY_NAME = "domain_1.test" @@ -61,7 +61,7 @@ async def test_init( ): sut_before_init.args = args - with wrap_exetuction(error_expected=error_expected, exception=ValueError): + with wrap_execution(error_expected=error_expected, exception=ValueError): await sut_before_init.init() if not error_expected: @@ -130,7 +130,7 @@ async def test_check_domain( monkeypatch.setattr(sut, "get_state", fake_fn(to_return=entities, async_=True)) - with wrap_exetuction( + with wrap_execution( error_expected=error_expected, exception=ValueError ) as err_info: await sut.check_domain(entity) @@ -164,7 +164,7 @@ async def fake_get_state(entity, attribute=None): monkeypatch.setattr(sut, "get_state", fake_get_state) - with wrap_exetuction(error_expected=expected_calls is None, exception=ValueError): + with wrap_execution(error_expected=expected_calls is None, exception=ValueError): await sut.get_entity_state(entity_input, "attribute_test") if expected_calls is not None: