Go to the documentation of this file.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
00037 import unittest
00038
00039 from rqt_py_common.rqt_roscomm_util import RqtRoscommUtil
00040
00041
00042 class TestRqtRoscommUtil(unittest.TestCase):
00043 """
00044 @author: Isaac Saito
00045 """
00046
00047 def setUp(self):
00048 unittest.TestCase.setUp(self)
00049
00050 self._totalnum_pkg_contains_launch = 41
00051
00052 def tearDown(self):
00053 unittest.TestCase.tearDown(self)
00054
00055
00056 def test_iterate_packages(self):
00057 """
00058 Not a very good test because the right answer that is hardcoded varies
00059 depending on the system where this unittest runs.
00060 """
00061 pkg_num_sum = 0
00062 for pkg in RqtRoscommUtil.iterate_packages('launch'):
00063 pkg_num_sum += 1
00064 print('pkg={}'.format(pkg))
00065
00066 print(pkg_num_sum)
00067 self.assertEqual(pkg_num_sum, self._totalnum_pkg_contains_launch)
00068
00069 def test_list_files(self):
00070 """
00071 Not a very good test because the right answer that is hardcoded varies
00072 depending on the system where this unittest runs.
00073 """
00074 file_num = 0
00075 pkg_name = 'pr2_moveit_config'
00076 _totalnum_launches_pkg_contains = 15
00077 subdir = 'launch'
00078 file_ext = '.launch'
00079 files = RqtRoscommUtil.list_files(pkg_name, subdir, file_ext)
00080 for file in files:
00081 file_num += 1
00082 print('file={}'.format(file))
00083
00084 print(file_num)
00085 self.assertEqual(file_num, _totalnum_launches_pkg_contains)
00086
00087
00088 if __name__ == '__main__':
00089 unittest.main()