Skip to content

Commit 1ce3dae

Browse files
authored
Fix test compatibility with looptime 0.7 (#612)
* Require looptime 0.7 or newer * Fix test compatibility with looptime 0.7
1 parent 854dd78 commit 1ce3dae

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

requirements_test.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ pytest
1212
python-slugify
1313
zigpy>=0.65.2
1414
ruff
15-
looptime
15+
looptime>=0.7
1616
freezegun
1717
coloredlogs

tests/conftest.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from types import TracebackType
1111
from unittest.mock import AsyncMock, MagicMock, patch
1212

13+
import looptime
1314
import pytest
1415
import zigpy
1516
from zigpy.application import ControllerApplication
@@ -300,6 +301,7 @@ async def __aenter__(self) -> Gateway:
300301
"""Start the ZHA gateway."""
301302

302303
with (
304+
looptime.enabled(),
303305
patch(
304306
"bellows.zigbee.application.ControllerApplication.new",
305307
return_value=self.app,
@@ -322,8 +324,9 @@ async def __aexit__(
322324
) -> None:
323325
"""Shutdown the ZHA gateway."""
324326
INSTANCES.remove(self.zha_gateway)
325-
await self.zha_gateway.shutdown()
326-
await asyncio.sleep(0)
327+
with looptime.enabled():
328+
await self.zha_gateway.shutdown()
329+
await asyncio.sleep(0)
327330

328331

329332
@pytest.fixture

0 commit comments

Comments
 (0)