00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 from __future__ import with_statement
00037
00038 NAME = 'test_roswtf_command_line_offline'
00039 import roslib; roslib.load_manifest('test_roswtf')
00040
00041 import os
00042 import sys
00043 import unittest
00044 import cStringIO
00045 import time
00046
00047 import rostest
00048
00049 from subprocess import Popen, PIPE, check_call, call
00050
00051 class TestRoswtfOffline(unittest.TestCase):
00052
00053 def setUp(self):
00054 pass
00055
00056
00057 def test_cmd_help(self):
00058 cmd = 'roswtf'
00059 output = Popen([cmd, '-h'], stdout=PIPE).communicate()[0]
00060 self.assert_('Options' in output)
00061
00062 def test_offline(self):
00063 cmd = 'roswtf'
00064
00065
00066 env = os.environ.copy()
00067 env['ROS_MASTER_URI'] = 'http://localhost:11312'
00068 import roslib.packages
00069 import roslib.stacks
00070 env['ROS_PACKAGE_PATH'] = roslib.stacks.get_stack_dir('ros_comm')
00071 cwd = roslib.packages.get_pkg_dir('test_roswtf')
00072 kwds = { 'env': env, 'stdout': PIPE, 'stderr': PIPE, 'cwd': cwd}
00073
00074
00075 output = Popen([cmd], **kwds).communicate()
00076
00077 self.assert_('No errors or warnings' in output[0], "OUTPUT[%s]"%str(output))
00078 self.assert_('ERROR' not in output[0], "OUTPUT[%s]"%str(output))
00079
00080
00081 import roslib.packages
00082 p = os.path.join(roslib.packages.get_pkg_dir('test_roswtf'), 'test', 'min.launch')
00083 output = Popen([cmd, p], **kwds).communicate()[0]
00084 self.assert_('No errors or warnings' in output, "OUTPUT[%s]"%output)
00085 self.assert_('ERROR' not in output, "OUTPUT[%s]"%output)
00086
00087 if __name__ == '__main__':
00088 rostest.unitrun('test_roswtf', NAME, TestRoswtfOffline, sys.argv, coverage_packages=[])