lcov_cobertura package

Submodules

Module contents

Coverage conversion tool to make lcov output compatible with tools that expect Cobertura/coverage.py format.

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 'http://cobertura.sourceforge.net/xml/coverage-04.dtd'>
  ...
convert()[source]

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.

Parameters:

coverage_data (dict) – Nested dict representing coverage information.

parse(**kwargs)[source]

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