File tree Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Expand file tree Collapse file tree 1 file changed +30
-3
lines changed Original file line number Diff line number Diff line change 1515# See the License for the specific language governing permissions and
1616# limitations under the License.
1717
18+ import logging
1819import unittest
1920
21+ from robot_descriptions ._descriptions import DESCRIPTIONS
2022from robot_descriptions .loaders .robomeshcat import load_robot_description
2123
2224
2325class 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+ )
You can’t perform that action at this time.
0 commit comments