diff --git a/requirements_test.txt b/requirements_test.txt index cbfd75bde..f80536689 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -12,6 +12,6 @@ pytest python-slugify zigpy>=0.65.2 ruff -looptime +looptime>=0.7 freezegun coloredlogs diff --git a/tests/conftest.py b/tests/conftest.py index c6b805de2..990d3e1ba 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,6 +10,7 @@ from types import TracebackType from unittest.mock import AsyncMock, MagicMock, patch +import looptime import pytest import zigpy from zigpy.application import ControllerApplication @@ -300,6 +301,7 @@ async def __aenter__(self) -> Gateway: """Start the ZHA gateway.""" with ( + looptime.enabled(), patch( "bellows.zigbee.application.ControllerApplication.new", return_value=self.app, @@ -322,8 +324,9 @@ async def __aexit__( ) -> None: """Shutdown the ZHA gateway.""" INSTANCES.remove(self.zha_gateway) - await self.zha_gateway.shutdown() - await asyncio.sleep(0) + with looptime.enabled(): + await self.zha_gateway.shutdown() + await asyncio.sleep(0) @pytest.fixture