lcov_cobertura package

Module contents

Converts lcov line coverage output to Cobertura-compatible XML for CI

class lcov_cobertura.Demangler[source]

Bases: object

class lcov_cobertura.LcovCobertura(lcov_data, base_dir='.', excludes=None, demangle=False)[source]

Bases: object

Converts code coverage report files in lcov format to Cobertura’s XML report format so that CI servers like Jenkins can aggregate results and determine build stability etc.

>>> from lcov_cobertura import LcovCobertura
>>> LCOV_INPUT = 'your lcov input'
>>> converter = LcovCobertura(LCOV_INPUT)
>>> cobertura_xml = converter.convert()
>>> print(cobertura_xml)
<?xml version="1.0" ?>
<!DOCTYPE coverage
  SYSTEM ''>

Convert lcov file to cobertura XML using options from this instance.

generate_cobertura_xml(coverage_data, **kwargs)[source]

Given parsed coverage data, return a String cobertura XML representation.


coverage_data (dict) – Nested dict representing coverage information.


Generate a data structure representing it that can be serialized in any logical format.


Converts LCOV coverage data to Cobertura-compatible XML for reporting.

Usage: lcov-file.dat lcov-file.dat -b src/dir -e test.lib -o path/out.xml

By default, XML output will be written to ./coverage.xml