error when running rostest.rosrun

asked 2018-10-04 07:12:30 -0500

JaLo gravatar image

I am following this tutorial for trying to implement unit tests on my project. However, when the instruction rostest.rosrun(PKG, 'test_bare_bones, TestBareBones) I obtain the following error:

[ROSUNIT] Outputting test results to /home/jalop17/.ros/test_results/basic_package/rosunit-test_bare_bones.xml
Traceback (most recent call last):
  File "/home/jalop17/01-scripts/02-Python/ros_test_workspace/src/basic_package/test/", line 15, in <module>
    rostest.rosrun(PKG, 'test_bare_bones', TestBareBones)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rostest/", line 146, in rosrun
    result = rosunit.create_xml_runner(package, test_name, result_file).run(suite)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosunit/", line 275, in run
    result.print_report(stream, time_taken, out_s, err_s)
  File "/opt/ros/melodic/lib/python2.7/dist-packages/rosunit/", line 202, in print_report
    stream.write(ET.tostring(self.xml(time_taken, out, err).getroot(), encoding='utf-8', method='xml'))
TypeError: write() argument must be str, not bytes

I am using ROS melodic on Ubuntu18.04. I tried running the code with Python2, and Python3. I also created a complete new workspace and package from scratch for possible avoiding setup errors, but I am not able to figure out the problem.

edit retag flag offensive close merge delete