22 from unittest
import TestCase
23 from std_srvs.srv
import SetBool
25 PKG =
"sr_robot_commander" 30 Tests the Robot State Exporter 34 if not os.path.exists(
"/tmp/test_exporter"):
35 os.mkdir(
"/tmp/test_exporter")
39 shutil.rmtree(
"/tmp/test_exporter", ignore_errors=
True)
42 rospy.init_node(
'test_hand_commander', anonymous=
True)
62 rospy.wait_for_service(
"/has_robot_state")
64 state_exporter.extract_all()
65 state_exporter.output_module(self.
test_path +
"/exporter_output_all.py")
66 from exporter_output_all
import warehouse_states
67 self.assertEqual(warehouse_states, self.
expected_states, msg=
"Export all states failed:" +
71 rospy.wait_for_service(
"/has_robot_state")
73 state_exporter.extract_one_state(
"state1")
74 state_exporter.output_module(self.
test_path +
"/exporter_output_state.py")
75 from exporter_output_state
import warehouse_states
76 self.assertEqual(warehouse_states, self.
expected_state, msg=
"Export all states failed:" +
80 rospy.wait_for_service(
"/has_robot_state")
82 state_exporter.extract_list([
"state1"])
83 state_exporter.output_module(self.
test_path +
"/exporter_output_list.py")
84 from exporter_output_list
import warehouse_states
85 self.assertEqual(warehouse_states, self.
expected_state, msg=
"Export all states failed:" +
89 if __name__ ==
"__main__":
91 rostest.rosrun(PKG,
"test_robot_state_exporter", TestSrRobotStateExporter)
def test_extract_all(self)
def test_extract_one_state(self)
def test_extract_list(self)