Skip to content

Commit

Permalink
Move tests to one single tests
Browse files Browse the repository at this point in the history
This should avoid that different tests run in parallel
  • Loading branch information
fmauch committed Jun 24, 2023
1 parent e9081a2 commit 097258d
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions ur_robot_driver/test/urscript_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 097258d

Please sign in to comment.