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:
6868 assert ret_code == expected_rc
6969 expected_rc += 1
7070
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+
7189 def test_loop_is_connected (self ):
7290 """
7391 loop() should throw MMQTTException if not connected
You can’t perform that action at this time.
0 commit comments