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:
44
44
ssl_context = ssl .create_default_context (),
45
45
)
46
46
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
49
52
50
53
time_before = time .monotonic ()
51
54
timeout = random .randint (3 , 8 )
52
55
rcs = mqtt_client .loop (timeout = timeout )
53
56
time_after = time .monotonic ()
54
57
55
58
assert time_after - time_before >= timeout
56
- mock_method .assert_called ()
59
+ wait_for_msg_mock .assert_called ()
57
60
58
61
# Check the return value.
59
62
assert rcs is not None
You can’t perform that action at this time.
0 commit comments