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

Code coverage with pytest-based ROS tests

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

jorge gravatar image

Hi,

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:

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

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

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/config_server_node.py              7      0   100%
src/config_server/config_server.py     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
0

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

3 followers

Stats

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

Seen: 262 times

Last updated: Aug 26 '22