Skip to content

Instantly share code, notes, and snippets.

@agutenkunst
Last active May 19, 2020 13:17
Show Gist options
  • Save agutenkunst/09ae39670f753b913cbe9f42fea042b0 to your computer and use it in GitHub Desktop.
Save agutenkunst/09ae39670f753b913cbe9f42fea042b0 to your computer and use it in GitHub Desktop.
Code Coverage für pytest mit ROS

Code Coverage für pytest mit ROS

Goal

Create coverage for pytest using ROS

How is this working with unittests?

A python unittest is added to the CMakeLists.txt using

catkin_add_nosetests(unittest.py)

where the CMake-Macro is defined in https://github.com/ros/catkin

here to macro checks for the environment variable CATKIN_TEST_COVERAGE and will enable the coverage flags

if("$ENV{CATKIN_TEST_COVERAGE}" STREQUAL "1")
  set(_covarg " --with-coverage")
endif()

src

How could/should we extend this for pytest?

A python pytest is added to the CMakeLists.txt using

add_pytest(pytest.py)

where CMake-Macro is define in https://github.com/machinekoder/ros_pytest

However inside this Macro the essential part is commented out see

Steps done

Next steps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment