Skip to content

Commit

Permalink
Do not wait for timeout in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
basilfx committed Jan 1, 2021
1 parent 2d2fd86 commit 8f050f3
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/core_tests/payload_reader_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Unit test for payload reader."""
import asyncio
import unittest
from unittest.mock import MagicMock, patch
from unittest.mock import AsyncMock, MagicMock, patch

from xknx import XKNX
from xknx.core import PayloadReader
Expand Down Expand Up @@ -36,7 +36,6 @@ def _register_telegram_received_cb(func):

def test_payload_reader_send_success(self):
"""Test payload reader: successful send."""

xknx = XKNX()

destination_address = IndividualAddress("1.2.3")
Expand All @@ -63,13 +62,12 @@ def test_payload_reader_send_success(self):
@patch("logging.Logger.warning")
def test_payload_reader_send_timeout(self, logger_warning_mock):
"""Test payload reader: timeout while waiting for response."""

xknx = XKNX()

destination_address = IndividualAddress("1.2.3")
request_payload = MemoryRead(0xAABB, 3)

payload_reader = PayloadReader(xknx, destination_address)
payload_reader = PayloadReader(xknx, destination_address, timeout_in_seconds=0)

payload = self.loop.run_until_complete(
payload_reader.send(request_payload, response_class=MemoryResponse)
Expand All @@ -80,6 +78,6 @@ def test_payload_reader_send_timeout(self, logger_warning_mock):
# Warning was logged.
logger_warning_mock.assert_called_once_with(
"Error: KNX bus did not respond in time (%s secs) to payload request for: %s",
2.0,
0.0,
IndividualAddress("1.2.3"),
)

0 comments on commit 8f050f3

Please sign in to comment.