ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Pytest in ros2

asked 2022-05-02 10:23:40 -0600

Flash gravatar image

Hi,
I had never used pytest for ros before. I was looking for some examples of how to set up pytest and use colcon test to test it out. Inside setup.py for the packages I see tests_require = ['pytest'] and also that pkg contains test and resources folder, but not sure how to use it. Some basic examples would be much appreciated.
Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-05-02 10:46:08 -0600

130s gravatar image

There's an option in colcon test (ref (colcon.readthedocs.io)):

--python-testing {pytest,setuppy_test}

Note that these are for "pure Python" test cases, i.e. tests that don't involve ROS nodes. For tests with ROS nodes, in ROS1 you can use rostest. In ROS2, #q292100 (started in 2018) indicates there's no equivalent.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-05-02 10:23:40 -0600

Seen: 1,363 times

Last updated: May 02 '22