Skip to main content

LCOV to Cobertura XML converter

Project description

lcov to cobertura XML converter

CI Docs Security check - Bandit Release

This project does as the name implies: it 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.

Coverage metrics supported:

  • Package/folder overall line and branch coverage
  • Class/file overall line and branch coverage
  • Functions hit
  • Line and Branch hits

Quick usage

Grab it raw and run it with python:

python lcov_cobertura.py lcov-file.dat
  • -b/--base-dir - (Optional) Directory where source files are located. Defaults to the current directory
  • -e/--excludes - (Optional) Comma-separated list of regexes of packages to exclude
  • -o/--output - (Optional) Path to store cobertura xml file. Defaults to ./coverage.xml
  • -d/--demangle - (Optional) Demangle C++ function names. Requires c++filt
python lcov_cobertura.py lcov-file.dat --base-dir src/dir --excludes test.lib --output build/coverage.xml --demangle

With pip:

pip install lcov_cobertura

Command-line usage

lcov_cobertura lcov-file.dat
  • -b/--base-dir - (Optional) Directory where source files are located. Defaults to the current directory
  • -e/--excludes - (Optional) Comma-separated list of regexes of packages to exclude
  • -o/--output - (Optional) Path to store cobertura xml file. Defaults to ./coverage.xml
  • -d/--demangle - (Optional) Demangle C++ function names. Requires c++filt
lcov_cobertura lcov-file.dat --base-dir src/dir --excludes test.lib --output build/coverage.xml --demangle

Usage as a Python module

Use it anywhere in your python:

from lcov_cobertura import LcovCobertura

LCOV_INPUT = 'SF:foo/file.ext\nDA:1,1\nDA:2,0\nend_of_record\n'
converter = LcovCobertura(LCOV_INPUT)
cobertura_xml = converter.convert()
print(cobertura_xml)

Environment Support

Python 3.8+ is supported. The last release with Python 2.x support is version 1.6.

Contributions

This project is made possible due to the efforts of these fine people:

License

This project is provided under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lcov_cobertura-2.0.2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

lcov_cobertura-2.0.2-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file lcov_cobertura-2.0.2.tar.gz.

File metadata

  • Download URL: lcov_cobertura-2.0.2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for lcov_cobertura-2.0.2.tar.gz
Algorithm Hash digest
SHA256 c6ce347bf3ee67f8d5d020cd662626a3594cf2be727cc634aa0d11fa3f7f1374
MD5 ca3833facd11177275a2176d58dce7c2
BLAKE2b-256 5651c6aef321778fbdf3d11653dd2cce3af6cba6ba6037295634425f502aafca

See more details on using hashes here.

File details

Details for the file lcov_cobertura-2.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lcov_cobertura-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc40cdc21cebb3ac9a62a277d64552734d3cd5e96c5eff95ac7eef90e1a2966c
MD5 c88b331968c2946acc26438f3c905ef9
BLAKE2b-256 0b7962a957410a368d1d3e2f0fa411820d4ff7eec393ced882d60464773002e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page