File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 99from unittest import TestCase , main
1010from unittest .mock import Mock
1111
12+ from mocket import Mocket
13+
1214import 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
You can’t perform that action at this time.
0 commit comments