45 SERVICE_BEFORE =
'service_order_before' 46 SERVICE_AFTER =
'service_order_after' 53 print(
"Returning fake_secret")
54 return EmptyReqSrvResponse(FAKE_SECRET)
57 s = rospy.Service(SERVICE_BEFORE, EmptyReqSrv, handle_empty_req)
58 rospy.init_node(
'service_before')
63 rospy.init_node(
'service_after')
64 s = rospy.Service(SERVICE_AFTER, EmptyReqSrv, handle_empty_req)
69 def _test(self, name, srv, req):
70 rospy.wait_for_service(name, WAIT_TIMEOUT)
71 s = rospy.ServiceProxy(name, srv)
73 self.assert_(resp
is not None)
76 resp = self.
_test(SERVICE_BEFORE, EmptyReqSrv,
78 self.assertEquals(FAKE_SECRET, resp.fake_secret,
79 "fake_secret fields is not set as expected")
81 resp = self.
_test(SERVICE_AFTER, EmptyReqSrv,
83 self.assertEquals(FAKE_SECRET, resp.fake_secret,
84 "fake_secret fields is not set as expected")
86 if __name__ ==
'__main__':
87 if '--before' in sys.argv:
89 elif '--after' in sys.argv:
92 rostest.run(PKG,
'rospy_service_decl_order', TestServiceOrder, sys.argv)
def handle_empty_req(req)
def _test(self, name, srv, req)