[ros-users] [Discourse.ros.org] [Quality Assurance] Pytest support for ROS / rostest

Alexander Rössler ros.discourse at gmail.com
Mon Jun 4 21:02:55 UTC 2018

> After reading the blog, I didnt quite get how pytest makes unit testing easy and quick. I mean it looks like it does, but did you find it easier and quicker than nosetests that ROS is already integrated with? Im simply curious, as ROS allows to run unit testing by nosetests as well as integrate it into Node testing.

I should have elaborated on this. I have only tried `nosetests` for testing parts of Machinekit. From what I know it just extends Python unittest, which is not great after all. `nosetests` also supports test functions (no need to write a complex test runner class), which is great. However, `pytest` seems to be a lot easier when it comes to writing and fixtures. Additionally, it makes great use of assert, including meaningful error messages. Writing pytests feels in my opinion just more natural and pythonic.

> Not sure what you mean by ROS seems to pick up the test data very well. But Id agree the test result is not the easiest to read. In your particular case, have you tried catkin_test_results?

    ros$ catkin_test_results 

    build/ros_pytest/test_results/ros_pytest/rosunit-test_lib.xml: 2 tests, 0 errors, 1 failures, 0 skipped

    Summary: 3 tests, 0 errors, 1 failures, 0 skipped

Actually looks good. I just wondered why it does not "crash" or abort with an error message when the tests are run. But I'm not that familiar with ROS yet.


[Visit Topic](https://discourse.ros.org/t/pytest-support-for-ros-rostest/4990/4) or reply to this email to respond.

More information about the ros-users mailing list