$search
00001 #!/usr/bin/env python 00002 00003 PKG='cob_srvs' 00004 import roslib; roslib.load_manifest(PKG) 00005 00006 import sys 00007 import unittest 00008 00009 import rospy 00010 00011 from cob_srvs.srv import * 00012 00013 class InitTest(unittest.TestCase): 00014 def __init__(self, *args): 00015 super(InitTest, self).__init__(*args) 00016 rospy.init_node("test_init_node") 00017 00018 def test_init(self): 00019 # call init service 00020 rospy.wait_for_service('init',10) 00021 call_init = rospy.ServiceProxy('init', Trigger) 00022 try: 00023 resp1 = call_init() 00024 except rospy.ServiceException, e: 00025 self.assertTrue(False, "calling init service failed: " +str(e)) 00026 00027 # evaluate response 00028 self.assertTrue(resp1.success.data, "init not succesfull: "+ resp1.error_message.data) 00029 00030 if __name__ == '__main__': 00031 import rostest 00032 rostest.rosrun(PKG, 'test_init', InitTest)