File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,24 @@ def test_loop_basic(self) -> None:
68
68
assert ret_code == expected_rc
69
69
expected_rc += 1
70
70
71
+ def test_loop_timeout_vs_socket_timeout (self ):
72
+ """
73
+ loop() should throw MMQTTException if the timeout argument is bigger than the socket timeout.
74
+ """
75
+ mqtt_client = MQTT .MQTT (
76
+ broker = "127.0.0.1" ,
77
+ port = 1883 ,
78
+ socket_pool = socket ,
79
+ ssl_context = ssl .create_default_context (),
80
+ socket_timeout = 1
81
+ )
82
+
83
+ mqtt_client .is_connected = lambda : True
84
+ with self .assertRaises (MQTT .MMQTTException ) as context :
85
+ mqtt_client .loop (timeout = 0.5 )
86
+
87
+ assert "loop timeout" in str (context .exception )
88
+
71
89
def test_loop_is_connected (self ):
72
90
"""
73
91
loop() should throw MMQTTException if not connected
You can’t perform that action at this time.
0 commit comments