Skip to content

Commit 27db2a3

Browse files
committed
python: Add WITH_SDFORMAT flag in Python binding and only run SDF test when this flag is defined
1 parent 4086e07 commit 27db2a3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

bindings/python/utils/dependencies.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ namespace pinocchio
4040
#else
4141
false;
4242
#endif
43+
44+
bp::scope().attr("WITH_SDFORMAT") =
45+
#ifdef PINOCCHIO_WITH_SDFORMAT
46+
true;
47+
#else
48+
false;
49+
#endif
4350
}
4451

4552
} // namespace python

unittest/python/robot_wrapper.py

+2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ def test_urdf_with_root_joint_and_root_joint_name(self):
5757
)
5858
self.assertEqual(robot.model.names[1], name_)
5959

60+
@unittest.skipUnless(pin.WITH_SDFORMAT, "Needs SDFORMAT")
6061
def test_sdf_with_root_joint(self):
6162
model_path = os.path.abspath(
6263
os.path.join(self.current_file, "../../models/simple_humanoid.sdf")
6364
)
6465
robot = pin.RobotWrapper.BuildFromSDF(model_path, [], pin.JointModelFreeFlyer())
6566
self.assertEqual(robot.model.names[1], "root_joint")
6667

68+
@unittest.skipUnless(pin.WITH_SDFORMAT, "Needs SDFORMAT")
6769
def test_sdf_with_root_joint_and_root_joint_name(self):
6870
model_path = os.path.abspath(
6971
os.path.join(self.current_file, "../../models/simple_humanoid.sdf")

0 commit comments

Comments
 (0)