Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DeerMaximum committed Nov 17, 2023
1 parent cb08df5 commit a0b6dd4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
COE_SEND_ANALOG_VALUES_PACKAGE = "ta_cmi.coe.CoE.send_analog_values"
COE_SEND_DIGITAL_VALUES_PACKAGE = "ta_cmi.coe.CoE.send_digital_values"
COEAPI_RAW_REQUEST_PACKAGE = "ta_cmi.coe_api.CoEAPI._make_request_get"
COE_VERSION_CHECK_PACKAGE = "ta_cmi.coe.CoE._check_version"
SETUP_ENTRY_PACKAGE = "custom_components.ta_coe.async_setup_entry"
STATE_AVAILABLE_PACKAGE = "homeassistant.core.StateMachine.get"
STATE_SENDER_UPDATE_DIGITAL_MANUEL_PACKAGE = (
Expand Down
16 changes: 16 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
"""Fixtures for testing."""
from unittest import mock

import pytest

from tests import COE_VERSION_CHECK_PACKAGE


@pytest.fixture(autouse=True)
def auto_enable_custom_integrations(enable_custom_integrations):
"""Enable enable_custom_integrations"""
yield


@pytest.fixture(scope="session", autouse=True)
def patch_coe_server_check(request):
"""Patch the ta-cmi CoE server version check."""
patched = mock.patch(COE_VERSION_CHECK_PACKAGE)
patched.__enter__()

def unpatch():
patched.__exit__(None, None, None)

request.addfinalizer(unpatch)

0 comments on commit a0b6dd4

Please sign in to comment.