test_urdf_files.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Copyright (c) 2016 The UUV Simulator Authors.
3 # All rights reserved.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 from __future__ import print_function
17 import rospy
18 import unittest
19 import subprocess
20 import os
21 
22 PKG = 'desistek_saga_description'
23 NAME = 'test_urdf_files'
24 
25 import roslib
26 roslib.load_manifest(PKG)
27 
28 
29 def call_xacro(xml_file):
30  assert os.path.isfile(xml_file), 'Invalid XML xacro file'
31  return subprocess.check_output(['xacro', '--inorder', xml_file])
32 
33 
34 class TestURDFFiles(unittest.TestCase):
35  def test_xacro(self):
36  # Retrieve the root folder for the tests
37  test_dir = os.path.abspath(os.path.dirname(__file__))
38  robots_dir = os.path.join(test_dir, '..', 'robots')
39 
40  for item in os.listdir(robots_dir):
41  if not os.path.isfile(os.path.join(robots_dir, item)):
42  continue
43  output = call_xacro(os.path.join(robots_dir, item))
44  self.assertNotIn(
45  output,
46  'XML parsing error',
47  'Parsing error found for file {}'.format(item))
48  self.assertNotIn(
49  output,
50  'No such file or directory',
51  'Some file not found in {}'.format(item))
52 
53 if __name__ == '__main__':
54  import rosunit
55  rosunit.unitrun(PKG, NAME, TestURDFFiles)
56 
57 
58 
def call_xacro(xml_file)


desistek_saga_description
Author(s): Emre Ege , Musa Morena Marcusso Manhaes , Sebastian Scherer , Luiz Ricardo Douat
autogenerated on Sun Apr 28 2019 02:12:18