$search
00001 #!/usr/bin/env python 00002 PKG='cob_description' 00003 import roslib; roslib.load_manifest(PKG) 00004 00005 import sys 00006 import os 00007 import unittest 00008 00009 ## A sample python unit test 00010 class TestUrdf(unittest.TestCase): 00011 00012 def test_correct_format(self): 00013 print sys.argv 00014 print len(sys.argv) 00015 00016 if len(sys.argv) < 2: 00017 self.fail("no urdf file given, usage: " + os.path.basename(sys.argv[0]) + " file.urdf.xacro. \ninput parameters are: " + str(sys.argv)) 00018 00019 file_to_test = sys.argv[1] 00020 print "testing " + file_to_test 00021 00022 if os.system("`rospack find xacro`/xacro.py " + file_to_test + " > /tmp/test.urdf") != 0: 00023 self.fail("cannot convert xacro") 00024 00025 if os.system("`rospack find urdf_parser`/bin/check_urdf /tmp/test.urdf") != 0: 00026 self.fail("urdf not correct") 00027 00028 if __name__ == '__main__': 00029 import rosunit 00030 rosunit.unitrun(PKG, 'test_urdf', TestUrdf)