38 NAME =
'empty_service' 50 from test_rosmaster.srv
import AddTwoInts
52 rospy.wait_for_service(
'fail_two_ints', 10.)
53 p = rospy.ServiceProxy(
'fail_two_ints', AddTwoInts, persistent=
True)
54 for a
in [1, -1, 1, -1, -1, -1, -1, 1]:
58 self.assertEquals(resp.sum, 2)
60 self.fail(
"service call should have failed: %s,%s, %s"%(a, 1, resp.sum))
61 except rospy.ServiceException
as e:
66 self.fail(
"service call failed when it shouldn't have: %s"%str(e))
71 from test_rosmaster.srv
import AddTwoInts
73 rospy.wait_for_service(
'fail_two_ints', 10.)
74 p = rospy.ServiceProxy(
'fail_two_ints', AddTwoInts)
75 for a
in [1, -1, 1, -1, -1, -1, -1, 1]:
79 self.assertEquals(resp.sum, 2)
81 self.fail(
"service call should have failed")
82 except rospy.ServiceException:
87 self.fail(
"service call should have failed")
90 if __name__ ==
'__main__':
91 rostest.run(PKG,
'rospy_service_failure', TestServiceFailure, sys.argv)
def test_persistent(self)
def test_non_persistent(self)