mirror of
https://github.com/home-assistant/core.git
synced 2026-08-24 10:13:52 -05:00
Async fixture for stiebel_eltron (#178580)
This commit is contained in:
committed by
Bram Kragten
parent
284f4e9130
commit
d1d0596719
@@ -1,6 +1,6 @@
|
||||
"""Common fixtures for the STIEBEL ELTRON tests."""
|
||||
|
||||
from collections.abc import Generator
|
||||
from collections.abc import AsyncGenerator, Generator
|
||||
from unittest.mock import AsyncMock, MagicMock, patch
|
||||
|
||||
from modbus_connection.mock import MockModbusConnection
|
||||
@@ -32,10 +32,11 @@ def mock_get_controller_model() -> Generator[MagicMock]:
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def mock_connect_tcp(
|
||||
async def mock_connect_tcp(
|
||||
mock_modbus_connection: MockModbusConnection,
|
||||
) -> Generator[AsyncMock]:
|
||||
) -> AsyncGenerator[AsyncMock]:
|
||||
"""Patch connect_tcp to return the in-memory mock connection."""
|
||||
await mock_modbus_connection.connect()
|
||||
connect = AsyncMock(return_value=mock_modbus_connection)
|
||||
with (
|
||||
patch("homeassistant.components.stiebel_eltron.connect_tcp", new=connect),
|
||||
|
||||
Reference in New Issue
Block a user