Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.
This repository was archived by the owner on May 31, 2025. It is now read-only.

rostest.rosrun fails to create coverage report #558

@VGonPa

Description

@VGonPa

Trying to run rostest with sysargs=--cov throws an exception in Hydro:

viki@vROS:[~/devel/mona...trunk/catkin_ws]$ rostest rospy_utils param_utils.test -t
... logging to /home/viki/.ros/log/rostest-vROS-27178.log
testTestParamUtils (rostest.runner.RosTest) ... [ROSTEST]setup[/home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/test/param_utils.test] run_id[136ec36a-a317-11e4-8c12-000c29ec1189] starting
started roslaunch server http://vROS:52272/
ros_comm version 1.10.10


SUMMARY
========

PARAMETERS
 * /rosdistro
 * /rosversion

NODES

[ROSTEST]setup[/home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/test/param_utils.test] run_id[136ec36a-a317-11e4-8c12-000c29ec1189] done
[ROSTEST]Running test [TestParamUtils]
auto-starting new master
process[master]: started with pid [27191]
ROS_MASTER_URI=http://vROS:22422/
setting /run_id to 136ec36a-a317-11e4-8c12-000c29ec1189
process[rosout-1]: started with pid [27205]
started core service [/rosout]
[ROSTEST]running test TestParamUtils
process[TestParamUtils-2]: started with pid [27217]
[ROSUNIT] Outputting test results to /home/viki/devel/rosbuild_ws/build/test_results/rospy_utils/rosunit-test_param_utils.xml
test_atach_parameters ... ok
test_attach_parameters_fails_if_not_allowed_to_create_new_attrib ... ok
test_attach_parameters_returns_empty_obj_if_emtpy_obj_is_passed ... ok
test_attach_parameters_returns_same_object_if_no_parameters ... ok
test_get_all_user_parameters ... ok
test_get_parameters ... ok
test_get_parameters_raises_ParamNotFoundError_when_not_founds_it ... ok
test_get_parameters_raises_TypeError_when_no_attr_passed ... ok
test_load_params ... ok
Traceback (most recent call last):
  File "/home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/src/test/test_param_utils.py", line 127, in <module>
    sysargs='--cov')
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostest/__init__.py", line 142, in rosrun
    _stop_coverage(package)
  File "/opt/ros/hydro/lib/python2.7/dist-packages/rostest/__init__.py", line 221, in _stop_coverage
    _cov.stop()
TypeError: can only concatenate list (not "str") to list
[TestParamUtils-2] process has died [pid 27217, exit code 1, cmd /home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/src/test/test_param_utils.py --gtest_output=xml:/home/viki/devel/rosbuild_ws/build/test_results/rospy_utils/rosunit-TestParamUtils.xml --text __name:=TestParamUtils __log:=/home/viki/.ros/log/136ec36a-a317-11e4-8c12-000c29ec1189/TestParamUtils-2.log].
log file: /home/viki/.ros/log/136ec36a-a317-11e4-8c12-000c29ec1189/TestParamUtils-2*.log
[ROSTEST]test [TestParamUtils] finished
[ROSTEST][ROSTEST] test [TestParamUtils] done
[ROSTEST]tearDown[/home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/test/param_utils.test]
shutting down processing monitor...
[rosout-1] killing on exit
[master] killing on exit
... shutting down processing monitor complete
[ROSTEST]rostest teardown /home/viki/devel/monarch/code/trunk/catkin_ws/src/rospy_utils/test/param_utils.test complete
ok

----------------------------------------------------------------------
Ran 1 test in 12.740s

OK

WARNING: overall test result is not accurate when --text is enabled
rostest log file is in /home/viki/.ros/log/rostest-vROS-27178.log

Digging a bit into the code of rostest.rosrun I've found that _stop_coverage() needs a [str] as a parameter while it is called only with a string: _stop_coverage(package)

I modified myself rostest.rosrun to call _stop_coverage([package]) and it seems to fix the issue.

I am going to open a PR so you can incorporate the fix.

Note I've found this bug in Hydro, but I did not checked other distros.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions