def test_offline(self): from ros import rosservice orig_uri = os.environ['ROS_MASTER_URI'] os.environ['ROS_MASTER_URI'] = 'http://fake_host:12356' try: c = 'rosservice' try: rosservice.get_service_type('/add_two_ints') self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_list([c, 'list']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_info([c, 'info', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_type([c, 'type', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_uri([c, 'uri', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_find( [c, 'find', 'test_ros/AddTwoInts']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_call( [c, 'call', '/add_two_ints', '1', '2']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass finally: os.environ['ROS_MASTER_URI'] = orig_uri
def test_offline(self): from ros import rosservice orig_uri = os.environ['ROS_MASTER_URI'] os.environ['ROS_MASTER_URI'] = 'http://fake_host:12356' try: c = 'rosservice' try: rosservice.get_service_type('/add_two_ints') self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_list([c, 'list']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_info([c, 'info', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_type([c, 'type', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_uri([c, 'uri', '/add_two_ints']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_find([c, 'find', 'test_ros/AddTwoInts']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass try: rosservice._rosservice_cmd_call([c, 'call', '/add_two_ints', '1', '2']) self.fail("should have raised ROSServiceIOException") except rosservice.ROSServiceIOException: pass finally: os.environ['ROS_MASTER_URI'] = orig_uri
def test_get_service_type(self): from ros import rosservice self.assertEquals('test_ros/AddTwoInts', rosservice.get_service_type('/add_two_ints')) self.assertEquals(None, rosservice.get_service_type('/fake_add_two_ints'))