Use async_timeout instead of asyncio.wait_for (#90496)

* Use async_timeout instead of asyncio.wait_for

* fix imports

* fix imports

* break out Event.wait patch

* Update tests/components/reolink/conftest.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Simplify

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
starkillerOG
2023-04-01 17:47:31 +02:00
committed by GitHub
parent 9cab05c4b9
commit b47ac524ea
4 changed files with 29 additions and 14 deletions

View File

@@ -39,8 +39,6 @@ def reolink_connect(mock_get_source_ip: None) -> Generator[MagicMock, None, None
with patch(
"homeassistant.components.reolink.host.webhook.async_register",
return_value=True,
), patch(
"homeassistant.components.reolink.host.asyncio.Event.wait", AsyncMock()
), patch(
"homeassistant.components.reolink.host.Host", autospec=True
) as host_mock_class:
@@ -65,6 +63,13 @@ def reolink_connect(mock_get_source_ip: None) -> Generator[MagicMock, None, None
yield host_mock
@pytest.fixture
def reolink_ONVIF_wait() -> Generator[None, None, None]:
"""Mock reolink connection."""
with patch("homeassistant.components.reolink.host.asyncio.Event.wait", AsyncMock()):
yield
@pytest.fixture
def reolink_platforms(mock_get_source_ip: None) -> Generator[None, None, None]:
"""Mock reolink entry setup."""