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 9
9
from unittest import TestCase , main
10
10
from unittest .mock import Mock
11
11
12
+ from mocket import Mocket
13
+
12
14
import adafruit_minimqtt .adafruit_minimqtt as MQTT
13
15
14
16
@@ -34,7 +36,7 @@ def test_recv_timeout_vs_keepalive(self) -> None:
34
36
)
35
37
36
38
# Create a mock socket that will accept anything and return nothing.
37
- socket_mock = Mock ( )
39
+ socket_mock = Mocket ( b"" )
38
40
socket_mock .recv_into = Mock (side_effect = side_effect )
39
41
mqtt_client ._sock = socket_mock
40
42
@@ -43,10 +45,6 @@ def test_recv_timeout_vs_keepalive(self) -> None:
43
45
with self .assertRaises (MQTT .MMQTTException ):
44
46
mqtt_client .ping ()
45
47
46
- # Verify the mock interactions.
47
- socket_mock .send .assert_called_once ()
48
- socket_mock .recv_into .assert_called ()
49
-
50
48
now = time .monotonic ()
51
49
assert recv_timeout <= (now - start ) <= (keep_alive + 0.1 )
52
50
You can’t perform that action at this time.
0 commit comments