From 097258dba99dc8572c79ad3befab4da93b80e836 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Sat, 24 Jun 2023 10:16:09 +0200 Subject: [PATCH] Move tests to one single tests This should avoid that different tests run in parallel --- ur_robot_driver/test/urscript_interface.py | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/ur_robot_driver/test/urscript_interface.py b/ur_robot_driver/test/urscript_interface.py index 0fc9732ef..b5acae575 100755 --- a/ur_robot_driver/test/urscript_interface.py +++ b/ur_robot_driver/test/urscript_interface.py @@ -201,6 +201,28 @@ def test_set_io(self): time.sleep(1) self.set_digout_checked(0, False) + self.io_msg = None + self.io_states_sub = self.node.create_subscription( + IOStates, + "/io_and_status_controller/io_states", + self.io_msg_cb, + rclpy.qos.qos_profile_system_default, + ) + + script_msg = StringMsg( + data="sec my_program():\n set_digital_out(0, False)\n set_digital_out(1,True)\nend" + ) + self.urscript_pub.publish(script_msg) + self.check_pin_states([0, 1], [False, True]) + + time.sleep(1) + + script_msg = StringMsg( + data="sec my_program():\n set_digital_out(0, True)\n set_digital_out(1,False)\nend" + ) + self.urscript_pub.publish(script_msg) + self.check_pin_states([0, 1], [True, False]) + def io_msg_cb(self, msg): self.io_msg = msg @@ -222,28 +244,6 @@ def check_pin_states(self, pins, states): pin_states[i] = self.io_msg.digital_out_states[pin_id].state self.assertEqual(pin_states, states) - def test_multiline_script(self): - """Tests sending a multiline script as secondary program.""" - self.io_msg = None - self.io_states_sub = self.node.create_subscription( - IOStates, - "/io_and_status_controller/io_states", - self.io_msg_cb, - rclpy.qos.qos_profile_system_default, - ) - - script_msg = StringMsg( - data="sec my_program():\n set_digital_out(0, False)\n set_digital_out(1,True)\nend" - ) - self.urscript_pub.publish(script_msg) - self.check_pin_states([0, 1], [False, True]) - - script_msg = StringMsg( - data="sec my_program():\n set_digital_out(0, True)\n set_digital_out(1,False)\nend" - ) - self.urscript_pub.publish(script_msg) - self.check_pin_states([0, 1], [True, False]) - def dashboard_call(self, srv_name, request): self.node.get_logger().info(f"Calling service '{srv_name}' with request {request}") future = self.dashboard_clients[srv_name].call_async(request)