Ask Your Question

Pytest in ros2

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

Flash gravatar image

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 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

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

130s gravatar image

There's an option in colcon test (ref (

--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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


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

Seen: 168 times

Last updated: May 02