Skip to content

Commit

Permalink
Merge pull request #758 from ipab-slmc/topic/disable-pip-test-for-rel…
Browse files Browse the repository at this point in the history
…ease

[exotica_python] Fail nicely when pip installed trimesh isnt available
  • Loading branch information
wxmerkt authored May 27, 2024
2 parents 7629f73 + 77b8b21 commit cb01244
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
8 changes: 6 additions & 2 deletions exotica_python/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-pyassimp</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-tk</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-rospkg</exec_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 2">python-trimesh-pip</test_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 3">python3-trimesh-pip</test_depend>
<!--
pip keys cannot be used for releases on the buildfarm cf.
https://github.com/ros/rosdistro/pull/39892#issuecomment-1985640859
-->
<!-- <test_depend condition="$ROS_PYTHON_VERSION == 2">python-trimesh-pip</test_depend>
<test_depend condition="$ROS_PYTHON_VERSION == 3">python3-trimesh-pip</test_depend> -->
</package>
15 changes: 13 additions & 2 deletions exotica_python/test/test_mesh.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
import unittest

import pyexotica as exo
import trimesh

try:
import trimesh
except ImportError:
from nose.plugins.skip import SkipTest

raise SkipTest("trimesh is not available, skipping related tests.")


def validate_mesh(mesh):
print(mesh, mesh.vertex_count, mesh.triangle_count)
assert mesh.vertex_count == 33
assert mesh.triangle_count == 62


class TestPythonMeshCreation(unittest.TestCase):
def test_create_mesh_from_resource_package_path(self):
# Load mesh from resource path
print(">>> Loading STL directly from package-path")
mesh = exo.Mesh.createMeshFromResource("package://exotica_examples/resources/cone.stl")
mesh = exo.Mesh.createMeshFromResource(
"package://exotica_examples/resources/cone.stl"
)
validate_mesh(mesh)

def test_create_mesh_from_resource_exotica_resource_path(self):
Expand Down Expand Up @@ -42,5 +52,6 @@ def teset_create_mesh_from_vertices_and_triangles(self):
mesh = exo.Mesh.createMeshFromVertices(m.vertices, m.faces.flatten())
validate_mesh(mesh)


if __name__ == "__main__":
unittest.main()

0 comments on commit cb01244

Please sign in to comment.