From ac701586bb13404f8d8697408f10f8c807d43d69 Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Sun, 6 Jul 2025 11:40:40 +0200 Subject: [PATCH] Fix pytest-asyncio usage --- tests/test_device.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_device.py b/tests/test_device.py index 4a61027..e732966 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -1,6 +1,6 @@ """Test communicating with a devolo device.""" -from asyncio import AbstractEventLoop +from asyncio import get_event_loop from unittest.mock import AsyncMock, Mock, patch import pytest @@ -104,10 +104,10 @@ async def test_async_disconnect(self, mock_device: Device): assert mock_device._session.aclose.call_count == 0 # type: ignore[attr-defined] assert not mock_device._connected - def test_disconnect(self, mock_device: Device, event_loop: AbstractEventLoop): + def test_disconnect(self, mock_device: Device): """Test that the sync disconnect method just calls the async disconnect method.""" with patch("devolo_plc_api.device.Device.async_disconnect", new=AsyncMock()) as ad: - mock_device._loop = event_loop + mock_device._loop = get_event_loop() mock_device.disconnect() assert ad.call_count == 1