45 from master
import MasterApiTestCase, set_node_name
58 self._testRegisterServiceSuccess()
62 self._testRegisterPublisherSuccess()
66 self._testRegisterPublisherTypes()
70 self._testRegisterSubscriberSimpleSuccess()
75 self._testUnregisterServiceSuccess()
79 self._testUnregisterPublisherSuccess()
83 self._testUnregisterSubscriberSuccess()
87 self._testRegisterServiceInvalid()
91 self._testRegisterPublisherInvalid()
95 self._testRegisterSubscriberInvalid()
100 self._testUnregisterServiceInvalid()
104 self._testUnregisterPublisherInvalid()
108 self._testUnregisterSubscriberInvalid()
112 if __name__ ==
'__main__':
117 from optparse
import OptionParser
118 parser = OptionParser(usage=
"usage: %prog [options] topic", prog=NAME)
121 parser.add_option(
"--text",dest=
"text_ignore", default=
False,
122 action=
"store_true", help=
"rostest standard option")
123 parser.add_option(
"--cov",dest=
"cov_ignore", default=
False,
124 action=
"store_true", help=
"rostest standard option")
126 parser.add_option(
"--simple",dest=
"simple", default=
False,
127 action=
"store_true", help=
"MasterSimpleApi")
129 parser.add_option(
"--gtest_output",dest=
"gtest_output", default=
'',
130 help=
"xml output file")
132 parser.add_option(
"--regsrvsuccess", dest=
"regsrvsuccess", default=
False,
133 action=
"store_true", help=
"MasterRegisterServiceSuccess")
134 parser.add_option(
"--regpubsuccess", dest=
"regpubsuccess", default=
False,
135 action=
"store_true", help=
"MasterRegisterPublisherSuccess")
136 parser.add_option(
"--regpubtypes", dest=
"regpubtypes", default=
False,
137 action=
"store_true", help=
"MasterRegisterPublisherTypes")
138 parser.add_option(
"--regsubsimplesuccess", dest=
"regsubsimplesuccess", default=
False,
139 action=
"store_true", help=
"MasterRegisterSubscriberSimpleSuccess")
142 parser.add_option(
"--unregsrvsuccess", dest=
"unregsrvsuccess", default=
False,
143 action=
"store_true", help=
"MasterUnregisterServiceSuccess")
144 parser.add_option(
"--unregpubsuccess", dest=
"unregpubsuccess", default=
False,
145 action=
"store_true", help=
"MasterUnregisterPublisherSuccess")
146 parser.add_option(
"--unregsubsuccess", dest=
"unregsubsuccess", default=
False,
147 action=
"store_true", help=
"MasterUnregisterSubscriberSuccess")
149 parser.add_option(
"--regsrvinvalid", dest=
"regsrvinvalid", default=
False,
150 action=
"store_true", help=
"MasterRegisterServiceInvalid")
151 parser.add_option(
"--regsubinvalid", dest=
"regsubinvalid", default=
False,
152 action=
"store_true", help=
"MasterRegisterSubscriberInvalid")
153 parser.add_option(
"--regpubinvalid", dest=
"regpubinvalid", default=
False,
154 action=
"store_true", help=
"MasterRegisterPublisherInvalid")
156 parser.add_option(
"--unregsrvinvalid", dest=
"unregsrvinvalid", default=
False,
157 action=
"store_true", help=
"MasterUnregisterServiceInvalid")
158 parser.add_option(
"--unregsubinvalid", dest=
"unregsubinvalid", default=
False,
159 action=
"store_true", help=
"MasterUnregisterSubscriberInvalid")
160 parser.add_option(
"--unregpubinvalid", dest=
"unregpubinvalid", default=
False,
161 action=
"store_true", help=
"MasterUnregisterPublisherInvalid")
164 (options, args) = parser.parse_args()
166 cls = MasterSimpleApi
168 elif options.regsrvsuccess:
169 cls = MasterRegisterServiceSuccess
170 elif options.regpubsuccess:
171 cls = MasterRegisterPublisherSuccess
172 elif options.regpubtypes:
173 cls = MasterRegisterPublisherTypes
174 elif options.regsubsimplesuccess:
175 cls = MasterRegisterSubscriberSimpleSuccess
177 elif options.unregsrvsuccess:
178 cls = MasterUnregisterServiceSuccess
179 elif options.unregpubsuccess:
180 cls = MasterUnregisterPublisherSuccess
181 elif options.unregsubsuccess:
182 cls = MasterUnregisterSubscriberSuccess
184 elif options.regsrvinvalid:
185 cls = MasterRegisterServiceInvalid
186 elif options.regpubinvalid:
187 cls = MasterRegisterPublisherInvalid
188 elif options.regsubinvalid:
189 cls = MasterRegisterSubscriberInvalid
191 elif options.unregsrvinvalid:
192 cls = MasterUnregisterServiceInvalid
193 elif options.unregpubinvalid:
194 cls = MasterUnregisterPublisherInvalid
195 elif options.unregsubinvalid:
196 cls = MasterUnregisterSubscriberInvalid
199 parser.error(
"you must specify a test to run with an [options] flag")
202 rospy.init_node(NAME, disable_rostime=
True)
204 rostest.rosrun(PKG, NAME, cls, sys.argv)
def testRegisterSubscriberSimpleSuccess(self)
def testUnregisterPublisherSuccess(self)
def testUnregisterSubscriberSuccess(self)
def set_node_name(name)
set_node_name() must be called prior to the unit test so that the test harness knows its ROS name...
def testRegisterPublisherInvalid(self)
def testRegisterPublisherSuccess(self)
def testUnregisterServiceSuccess(self)
def testRegisterPublisherTypes(self)
#591: this test may change if we make registering '*' unsupported
def testRegisterSubscriberInvalid(self)
def testRegisterServiceInvalid(self)
def testUnregisterSubscriberInvalid(self)
def testRegisterServiceSuccess(self)
def testUnregisterServiceInvalid(self)
def testUnregisterPublisherInvalid(self)