cobertura-clover-transform icon indicating copy to clipboard operation
cobertura-clover-transform copied to clipboard

str/bytes bug on Python3

Open numerodix opened this issue 7 years ago • 2 comments

$ python -V Python 3.5.2+

$ cobertura-clover-transform cobertura.xml b'<coverage generated ....snip...>\n'

So the problem is that on Python3 the xml document (which is a bytes) object is passed to print and comes out in repr form.

numerodix avatar Oct 12 '17 09:10 numerodix

+1

daggaz avatar Apr 21 '20 16:04 daggaz

Workarounds If you want the output in a file, just use the -o option:

cobertura-clover-transform cobertura.xml -o clover.xml

If you need the output on stdout:

temp_file=$(mktemp) && cobertura-clover-transform coverage.xml -o ${temp_file} && cat ${temp_file}; rm ${temp_file}; unset temp_file

If you want to pipe the output to another process:

temp_file=$(mktemp) && cobertura-clover-transform coverage.xml -o ${temp_file} && cat ${temp_file} | ANOTHER_PROCESS; rm ${temp_file}; unset temp_file

daggaz avatar Apr 21 '20 16:04 daggaz