Fix test_klapprotocol test duration (#698)

This commit is contained in:
Steven B 2024-01-24 08:20:44 +00:00 committed by GitHub
parent 8b566757c3
commit eb217a748c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,6 +6,7 @@ import struct
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(