File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -433,10 +433,6 @@ def connect(
433
433
except TemporaryError as e :
434
434
self .logger .warning (f"temporary error when connecting: { e } " )
435
435
backoff = False
436
- except OSError as e :
437
- last_exception = e
438
- self .logger .info (f"failed to connect: { e } " )
439
- backoff = True
440
436
except MMQTTException as e :
441
437
last_exception = e
442
438
self .logger .info (f"MMQT error: { e } " )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class PortSslSetup(TestCase):
20
20
def test_default_port (self ) -> None :
21
21
"""verify default port value and that TLS is not used"""
22
22
host = "127.0.0.1"
23
- port = 1883
23
+ expected_port = 1883
24
24
25
25
with patch .object (socket .socket , "connect" ) as connect_mock :
26
26
ssl_context = ssl .create_default_context ()
@@ -31,14 +31,15 @@ def test_default_port(self) -> None:
31
31
connect_retries = 1 ,
32
32
)
33
33
34
+ connect_mock .side_effect = OSError
34
35
ssl_mock = Mock ()
35
36
ssl_context .wrap_socket = ssl_mock
36
37
37
38
with self .assertRaises (MQTT .MMQTTException ):
38
- expected_port = port
39
39
mqtt_client .connect ()
40
40
41
41
ssl_mock .assert_not_called ()
42
+
42
43
connect_mock .assert_called ()
43
44
# Assuming the repeated calls will have the same arguments.
44
45
connect_mock .assert_has_calls ([call ((host , expected_port ))])
You can’t perform that action at this time.
0 commit comments