File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,19 @@ def test_loop_basic(self) -> None:
4444 ssl_context = ssl .create_default_context (),
4545 )
4646
47- with patch .object (mqtt_client , "_wait_for_msg" ) as mock_method :
48- mock_method .side_effect = self .fake_wait_for_msg
47+ with patch .object (mqtt_client , "_wait_for_msg" ) as wait_for_msg_mock , \
48+ patch .object (mqtt_client , "is_connected" ) as is_connected_mock :
49+
50+ wait_for_msg_mock .side_effect = self .fake_wait_for_msg
51+ is_connected_mock .side_effect = lambda : True
4952
5053 time_before = time .monotonic ()
5154 timeout = random .randint (3 , 8 )
5255 rcs = mqtt_client .loop (timeout = timeout )
5356 time_after = time .monotonic ()
5457
5558 assert time_after - time_before >= timeout
56- mock_method .assert_called ()
59+ wait_for_msg_mock .assert_called ()
5760
5861 # Check the return value.
5962 assert rcs is not None
You can’t perform that action at this time.
0 commit comments