Skip to content

Commit 6558d8b

Browse files
committed
test_recv_timeout.py: use Mocket so _send_bytes() will work
1 parent 3acb223 commit 6558d8b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/test_recv_timeout.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from unittest import TestCase, main
1010
from unittest.mock import Mock
1111

12+
from mocket import Mocket
13+
1214
import adafruit_minimqtt.adafruit_minimqtt as MQTT
1315

1416

@@ -34,7 +36,7 @@ def test_recv_timeout_vs_keepalive(self) -> None:
3436
)
3537

3638
# Create a mock socket that will accept anything and return nothing.
37-
socket_mock = Mock()
39+
socket_mock = Mocket(b"")
3840
socket_mock.recv_into = Mock(side_effect=side_effect)
3941
mqtt_client._sock = socket_mock
4042

@@ -43,10 +45,6 @@ def test_recv_timeout_vs_keepalive(self) -> None:
4345
with self.assertRaises(MQTT.MMQTTException):
4446
mqtt_client.ping()
4547

46-
# Verify the mock interactions.
47-
socket_mock.send.assert_called_once()
48-
socket_mock.recv_into.assert_called()
49-
5048
now = time.monotonic()
5149
assert recv_timeout <= (now - start) <= (keep_alive + 0.1)
5250

0 commit comments

Comments
 (0)