We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5fffe9 commit d8d4e39Copy full SHA for d8d4e39
1 file changed
tests/test_loop.py
@@ -68,6 +68,24 @@ def test_loop_basic(self) -> None:
68
assert ret_code == expected_rc
69
expected_rc += 1
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
89
def test_loop_is_connected(self):
90
"""
91
loop() should throw MMQTTException if not connected
0 commit comments