From 8c55b3e9e73ea9df4dc7ca60f3521b5031818280 Mon Sep 17 00:00:00 2001 From: sdb9696 Date: Wed, 24 Jan 2024 07:57:52 +0000 Subject: [PATCH] Fix test_klapprotocol test duration --- kasa/tests/test_klapprotocol.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kasa/tests/test_klapprotocol.py b/kasa/tests/test_klapprotocol.py index 09ceccaef..4d711f034 100644 --- a/kasa/tests/test_klapprotocol.py +++ b/kasa/tests/test_klapprotocol.py @@ -6,6 +6,7 @@ import sys import time from contextlib import nullcontext as does_not_raise +from unittest.mock import PropertyMock import aiohttp import pytest @@ -67,6 +68,7 @@ async def test_protocol_retries_via_client_session( ): host = "127.0.0.1" conn = mocker.patch.object(aiohttp.ClientSession, "post", side_effect=error) + mocker.patch.object(protocol_class, "BACKOFF_SECONDS_AFTER_TIMEOUT", 0) config = DeviceConfig(host) with pytest.raises(SmartDeviceException): @@ -95,6 +97,7 @@ async def test_protocol_retries_via_httpclient( ): host = "127.0.0.1" conn = mocker.patch.object(HttpClient, "post", side_effect=error) + mocker.patch.object(protocol_class, "BACKOFF_SECONDS_AFTER_TIMEOUT", 0) config = DeviceConfig(host) with pytest.raises(SmartDeviceException): @@ -117,6 +120,7 @@ async def test_protocol_no_retry_on_connection_error( "post", side_effect=AuthenticationException("foo"), ) + mocker.patch.object(protocol_class, "BACKOFF_SECONDS_AFTER_TIMEOUT", 0) config = DeviceConfig(host) with pytest.raises(SmartDeviceException): await protocol_class(transport=transport_class(config=config)).query(