{"id":5294,"library":"lcov-cobertura","title":"LCOV to Cobertura XML Converter","description":"lcov-cobertura is a Python library that converts code coverage reports from the LCOV format to the Cobertura XML format. This conversion is crucial for integration with Continuous Integration (CI) servers like Jenkins, which often use Cobertura XML to aggregate results and assess build stability. The library is actively maintained, with the current version 2.1.1 released in February 2025, and supports Python 3.8 and newer versions.","status":"active","version":"2.1.1","language":"en","source_language":"en","source_url":"https://github.com/eriwen/lcov-to-cobertura-xml","tags":["lcov","cobertura","code coverage","xml","ci","testing"],"install":[{"cmd":"pip install lcov_cobertura","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for demangling C++ function names when the '--demangle' option is used.","package":"c++filt","optional":true}],"imports":[{"symbol":"LcovCobertura","correct":"from lcov_cobertura import LcovCobertura"}],"quickstart":{"code":"from lcov_cobertura import LcovCobertura\n\n# Example LCOV input data\nlcov_input = \"\"\"\nSF:/path/to/source/file.py\nDA:1,1\nDA:2,0\nend_of_record\nSF:/path/to/another/file.py\nDA:5,1\nDA:6,1\nend_of_record\n\"\"\"\n\nconverter = LcovCobertura(lcov_input, base_dir='.')\ncobertura_xml = converter.convert()\nprint(cobertura_xml)","lang":"python","description":"Demonstrates how to use LcovCobertura as a Python module to convert LCOV data to Cobertura XML. The `base_dir` parameter is important for correctly resolving source file paths within the Cobertura report."},"warnings":[{"fix":"Upgrade your Python environment to 3.8 or newer, or use lcov-cobertura version 1.6 or older (not recommended due to lack of maintenance).","message":"Python 2.x support was dropped after version 1.6. Versions 2.0.0 and above explicitly require Python 3.8+.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Ensure `c++filt` (part of GNU Binutils) is installed and accessible in the system's PATH if C++ demangling is required.","message":"When using the '--demangle' command-line option or the `demangle=True` parameter in the `LcovCobertura` constructor, the `c++filt` utility must be available in your system's PATH. Without it, C++ function name demangling will fail silently or with an error.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always verify that `base_dir` points to the root directory where your source files are located relative to the paths in your LCOV report.","message":"Incorrectly setting the `--base-dir` (command-line) or `base_dir` (Python API) can lead to Cobertura XML reports with incorrect source file paths, preventing CI tools from linking coverage data to source files. The default is the current working directory.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}