File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,7 @@ def test_motion_controller_instantiation():
2323 """Instantiate MotionController."""
2424 coordinate = Coordinate ()
2525 robot_mqtt = RobotMQTT (
26- robot_id = 1 ,
27- mqtt_client = DummyMqttClient (),
28- coordinate = coordinate
26+ robot_id = 1 , mqtt_client = DummyMqttClient (), coordinate = coordinate
2927 )
3028 controller = MotionController (coordinate = coordinate , robot_mqtt = robot_mqtt )
3129 assert isinstance (controller , MotionController )
@@ -34,6 +32,7 @@ def test_motion_controller_instantiation():
3432def test_robot_base_run_and_shutdown ():
3533 """Test Robot base class run and shutdown."""
3634 import threading
35+ from unittest .mock import patch
3736
3837 from robot .robot_base import Robot
3938
@@ -51,8 +50,9 @@ def loop(self):
5150 self ._stop_event .set ()
5251
5352 robot = TestRobot (robot_id = "testbot" , loop_hz = 100 )
54- t = threading .Thread (target = robot .run )
55- t .start ()
56- t .join (timeout = 2 )
53+ with patch .object (robot .mqtt_client , "connect" , return_value = None ):
54+ t = threading .Thread (target = robot .run )
55+ t .start ()
56+ t .join (timeout = 2 )
5757 assert hasattr (robot , "setup_called" )
5858 assert robot .loop_called >= 1
You can’t perform that action at this time.
0 commit comments