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(
433433 except TemporaryError as e :
434434 self .logger .warning (f"temporary error when connecting: { e } " )
435435 backoff = False
436- except OSError as e :
437- last_exception = e
438- self .logger .info (f"failed to connect: { e } " )
439- backoff = True
440436 except MMQTTException as e :
441437 last_exception = e
442438 self .logger .info (f"MMQT error: { e } " )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class PortSslSetup(TestCase):
2020 def test_default_port (self ) -> None :
2121 """verify default port value and that TLS is not used"""
2222 host = "127.0.0.1"
23- port = 1883
23+ expected_port = 1883
2424
2525 with patch .object (socket .socket , "connect" ) as connect_mock :
2626 ssl_context = ssl .create_default_context ()
@@ -31,14 +31,15 @@ def test_default_port(self) -> None:
3131 connect_retries = 1 ,
3232 )
3333
34+ connect_mock .side_effect = OSError
3435 ssl_mock = Mock ()
3536 ssl_context .wrap_socket = ssl_mock
3637
3738 with self .assertRaises (MQTT .MMQTTException ):
38- expected_port = port
3939 mqtt_client .connect ()
4040
4141 ssl_mock .assert_not_called ()
42+
4243 connect_mock .assert_called ()
4344 # Assuming the repeated calls will have the same arguments.
4445 connect_mock .assert_has_calls ([call ((host , expected_port ))])
You can’t perform that action at this time.
0 commit comments