test_openni_desc.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 PKG = 'openni_description'
5 
6 import os
7 import subprocess
8 import unittest
9 
10 import rospkg
11 import xacro
12 
13 
14 class TestOpenniDescription(unittest.TestCase):
15 
16  def setUp(self):
17  pass
18 
19  def tearDown(self):
20  True
21 
23  """
24  Check if check_urdf command passes with the urdf that is generated in
25  the .test file this test case is called from.
26  """
27  resulted_urdf_file_relpath = "./sample_kobuki.urdf"
28  kobuki_xacro_file_path = rospkg.RosPack().get_path('openni_description') + "/test/model/kobuki_description/sample_kobuki.urdf.xacro"
29  self.assertTrue(os.path.isfile(kobuki_xacro_file_path))
30  xacro_output_memory = xacro.process_file(kobuki_xacro_file_path)
31  xacro_output_file = xacro.open_output(resulted_urdf_file_relpath)
32  xacro_output_file.write(xacro_output_memory.toprettyxml(indent=' '))
33  xacro_output_file.close()
34  self.assertTrue(os.path.isfile(resulted_urdf_file_relpath))
35  self.assertEqual(0, subprocess.call(["check_urdf", resulted_urdf_file_relpath]))
36 
37 if __name__ == '__main__':
38  import rostest
39  rostest.rosrun(PKG, 'test_openni_description', TestOpenniDescription)
def process_file(input_file_name, kwargs)
def open_output(output_filename)


openni_description
Author(s): Isaac I.Y. Saito
autogenerated on Mon Jun 10 2019 14:15:57