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.1.1.tar.gz (31.1 kB view details)

Uploaded Source

Built Distribution

lcov_cobertura-2.1.1-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lcov_cobertura-2.1.1.tar.gz
  • Upload date:
  • Size: 31.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lcov_cobertura-2.1.1.tar.gz
Algorithm Hash digest
SHA256 efa8e264f2bddebb7f5024e4ace12b633d9d59048bc647427d1e1b9688c8b58f
MD5 c272259fc1873c7d72a3229d4f8ea236
BLAKE2b-256 7bd064bda2ec25aff095a1adb41fdab22bc467e63d1cc5a8c5130ac2bf444b88

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lcov_cobertura-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lcov_cobertura-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 92f8107297f6d1d7a7a0a88c6071c1ea04f862f2fe918c6ecce271573c37d8aa
MD5 ab7c0f1c8a438c7657de78e62f368222
BLAKE2b-256 787a9b1448f18172e7034f1dcc717d804a86430cbd24fc7c38782a800bf3faae

See more details on using hashes here.

Supported by

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