Skip to main content

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.

Release files for lcov-cobertura 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lcov-cobertura 2.1.1
File Size Uploaded
lcov_cobertura-2.1.1.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lcov-cobertura 2.1.1
File Interpreter ABI Platform
lcov_cobertura-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 43.4 kB

Release files / lcov_cobertura-2.1.1.tar.gz

Download URL lcov_cobertura-2.1.1.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
efa8e264f2bddebb7f5024e4ace12b633d9d59048bc647427d1e1b9688c8b58f
BLAKE2b-256 checksum
How to use checksums
7bd064bda2ec25aff095a1adb41fdab22bc467e63d1cc5a8c5130ac2bf444b88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / lcov_cobertura-2.1.1-py3-none-any.whl

Download URL lcov_cobertura-2.1.1-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
92f8107297f6d1d7a7a0a88c6071c1ea04f862f2fe918c6ecce271573c37d8aa
BLAKE2b-256 checksum
How to use checksums
787a9b1448f18172e7034f1dcc717d804a86430cbd24fc7c38782a800bf3faae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.6

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1.1

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page