Skip to content

Commit d81b8a9

Browse files
stephane-caronStéphane Caron
authored andcommitted
[CI] Test RoboMeshCat on all descriptions
1 parent 1c959ec commit d81b8a9

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

tests/loaders/test_robomeshcat.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,17 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18+
import logging
1819
import unittest
1920

21+
from robot_descriptions._descriptions import DESCRIPTIONS
2022
from robot_descriptions.loaders.robomeshcat import load_robot_description
2123

2224

2325
class TestRoboMeshCat(unittest.TestCase):
2426

2527
"""
2628
Check that all descriptions are loaded properly in RoboMeshCat.
27-
28-
Since RoboMeshCat relies on Pinocchio, we only test it on a couple of
29-
robot descriptions.
3029
"""
3130

3231
def test_load_robot_description(self):
@@ -50,3 +49,31 @@ def test_collada_description(self):
5049
"""
5150
r2 = load_robot_description("r2_description")
5251
self.assertIsNotNone(r2)
52+
53+
@staticmethod
54+
def get_test_for_description(description: str):
55+
"""
56+
Get test function for a given description.
57+
58+
Args:
59+
description: Name of the description.
60+
61+
Returns:
62+
Test function for that description.
63+
"""
64+
65+
def test(self):
66+
logging.info(f"Loading {description} in RoboMeshCat...")
67+
load_robot_description(description)
68+
69+
return test
70+
71+
72+
# Add a test function for each URDF description
73+
for name, description in DESCRIPTIONS.items():
74+
if description.has_urdf:
75+
setattr(
76+
TestRoboMeshCat,
77+
f"test_{name}",
78+
TestRoboMeshCat.get_test_for_description(name),
79+
)

0 commit comments

Comments
 (0)