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

Code coverage with pytest-based ROS tests

asked 2022-08-09 05:17:18 -0600

jorge gravatar image


I'm trying to add code coverage to my pytests, following the instructions from code_coverage repo, except that I use python3-coverage.

I run my rostest with pytest using the Pytest integration instructions

So I run both prefixed with python3-coverage run -p. The rostest file looks like:

  <node name="config_server" pkg="config_server" type=""
        launch-prefix="python3-coverage run -p">

  <param name="test_module" value=""/>
  <test test-name="config_server_test" pkg="config_server" type="" time-limit="60.0"
        launch-prefix="python3-coverage run -p"/>

As explained in the issue I opened on code coverage repo, I'm actually getting a coverage report on screen, but all files are empty!

nodes/              7      0   100%
src/config_server/     138      8    94%

(see the whole command line output on the issue for details)

Has anyone tried this before and has an example of how to do?

Thanks a lot

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-08-26 01:11:52 -0600

jorge gravatar image

My bad: Python code coverage goes to somewhere else

Python code coverage html-format: /home/jorge/.ros/htmlcov/index.html.
edit flag offensive delete link more

Question Tools



Asked: 2022-08-09 05:17:18 -0600

Seen: 192 times

Last updated: Aug 26 '22