From 5251935229bc1f853457e996bb67f9aa16cf1522 Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Sat, 3 Jan 2026 18:19:32 +0100 Subject: [PATCH 1/2] Require looptime 0.7 or newer --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 2f9fe30be32453d4aa192a6965f1c02b25065b1d Mon Sep 17 00:00:00 2001 From: TheJulianJES Date: Sat, 3 Jan 2026 18:21:00 +0100 Subject: [PATCH 2/2] Fix test compatibility with looptime 0.7 --- tests/conftest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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