Skip to content

Commit

Permalink
refactor(tests): wrap_execution: change name because of a typo
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviml committed Jul 5, 2021
1 parent 1f86856 commit d7175b4
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/cx_core/color_helper_test.py
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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)
10 changes: 5 additions & 5 deletions tests/unit_tests/cx_core/controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)


Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/cx_core/integration/deconz_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/cx_core/integration/z2m_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/cx_core/type/cover_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/cx_core/type/light_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/cx_core/type_controller_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d7175b4

Please sign in to comment.