Skip to content

Commit

Permalink
[desc][test] Run the test only after ROS Jade where the method used f…
Browse files Browse the repository at this point in the history
…rom xacro becomes available.

[desc][test] I think xacro Python API is not meant to be used from outside of xacro pkg.

[ci] Disable tests on Indigo as tests in openni_description might never pass on Indigo due to xacro issue.
  • Loading branch information
130s committed Jan 14, 2018
1 parent 0aa80ac commit dc9b0f8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ notifications:
- [email protected]
env:
matrix:
- ROS_DISTRO="indigo" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true
- ROS_DISTRO="indigo" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu USE_DEB=true
- ROS_DISTRO="indigo" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true NOT_TEST_INSTALL=true
- ROS_DISTRO="indigo" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu USE_DEB=true NOT_TEST_INSTALL=true
- ROS_DISTRO="indigo" PRERELEASE=true PRERELEASE_DOWNSTREAM_DEPTH=1
- ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros/ubuntu USE_DEB=true
- ROS_DISTRO="kinetic" ROS_REPOSITORY_PATH=http://packages.ros.org/ros-shadow-fixed/ubuntu USE_DEB=true
Expand Down
4 changes: 3 additions & 1 deletion openni_description/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@ install(DIRECTORY model DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY test DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} USE_SOURCE_PERMISSIONS)
if (CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED COMPONENTS rostest)
add_rostest(test/sample_kobuki.test)
if("$ENV{ROS_DISTRO}" STRGREATER "jade")
add_rostest(test/sample_kobuki.test)
endif()
endif ()
13 changes: 10 additions & 3 deletions openni_description/test/test_openni_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import unittest

import rospkg
import xacro


class TestOpenniDescription(unittest.TestCase):
Expand All @@ -23,9 +24,15 @@ def test_urdf_turtlebot(self):
Check if check_urdf command passes with the urdf that is generated in
the .test file this test case is called from.
"""
self.assertTrue(os.path.isfile(rospkg.RosPack().get_path('openni_description') + "/test/sample_kobuki.urdf.xacro")
print(subprocess.check_output(["rosrun", "xacro", "xacro", rospkg.RosPack().get_path('openni_description') + "/test/sample_kobuki.urdf.xacro", "-o", "./sample_kobuki.urdf"]))
self.assertEqual(0, subprocess.call(["check_urdf", "./sample_kobuki.urdf"]))
resulted_urdf_file_relpath = "./sample_kobuki.urdf"
kobuki_xacro_file_path = rospkg.RosPack().get_path('openni_description') + "/test/sample_kobuki.urdf.xacro"
self.assertTrue(os.path.isfile(kobuki_xacro_file_path))
xacro_output_memory = xacro.process_file(kobuki_xacro_file_path)
xacro_output_file = xacro.open_output(resulted_urdf_file_relpath)
xacro_output_file.write(xacro_output_memory.toprettyxml(indent=' '))
xacro_output_file.close()
self.assertTrue(os.path.isfile(resulted_urdf_file_relpath))
self.assertEqual(0, subprocess.call(["check_urdf", resulted_urdf_file_relpath]))

if __name__ == '__main__':
import rostest
Expand Down

0 comments on commit dc9b0f8

Please sign in to comment.