Skip to content

Commit 4be327a

Browse files
Update test_motion.py
1 parent 9b7d541 commit 4be327a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/test_motion.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff 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():
3432
def 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

0 commit comments

Comments
 (0)