# lcov to cobertura XML converter
[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/ci.yml)
[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/sphinx.yml)
[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/bandit.yml)
[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/release.yml)
This project does as the name implies: it converts code coverage report files in [lcov](http://ltp.sourceforge.net/coverage/lcov.php) format to [Cobertura](http://cobertura.sourceforge.net/)'s XML report format so that CI servers like [Jenkins](http://jenkins-ci.org) 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](https://raw.github.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py) and run it with python:
```bash
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_
```bash
python lcov_cobertura.py lcov-file.dat --base-dir src/dir --excludes test.lib --output build/coverage.xml --demangle
```
## With [pip](http://pypi.python.org/pypi/pip):
```bash
pip install lcov_cobertura
```
### Command-line usage
```bash
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_
```bash
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:
```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](https://pypi.org/project/lcov_cobertura/1.6/).
## Contributions
This project is made possible due to the efforts of these fine people:
- [Eric Wendelin](https://eriwen.com)
- [Björge Dijkstra](https://github.com/bjd)
- [Jon Schewe](http://mtu.net/~jpschewe)
- [Yury V. Zaytsev](http://yury.zaytsev.net)
- [Steve Arnold](https://github.com/sarnold)
## License
This project is provided under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
Raw data
{
"_id": null,
"home_page": "https://eriwen.github.io/lcov-to-cobertura-xml/",
"name": "lcov-cobertura",
"maintainer": "Steve Arnold",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "nerdboy@gentoo.org",
"keywords": "lcov, cobertura",
"author": "Eric Wendelin",
"author_email": "me@eriwen.com",
"download_url": "https://files.pythonhosted.org/packages/7b/d0/64bda2ec25aff095a1adb41fdab22bc467e63d1cc5a8c5130ac2bf444b88/lcov_cobertura-2.1.1.tar.gz",
"platform": null,
"description": "# lcov to cobertura XML converter\n\n[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/ci.yml)\n[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/sphinx.yml)\n[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/bandit.yml)\n[](https://github.com/eriwen/lcov-to-cobertura-xml/actions/workflows/release.yml)\n\nThis project does as the name implies: it converts code coverage report files in [lcov](http://ltp.sourceforge.net/coverage/lcov.php) format to [Cobertura](http://cobertura.sourceforge.net/)'s XML report format so that CI servers like [Jenkins](http://jenkins-ci.org) can aggregate results and determine build stability etc.\n\nCoverage metrics supported:\n\n - Package/folder overall line and branch coverage\n - Class/file overall line and branch coverage\n - Functions hit\n - Line and Branch hits\n \n## Quick usage\n\n[Grab it raw](https://raw.github.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py) and run it with python:\n```bash\npython lcov_cobertura.py lcov-file.dat\n```\n\n - `-b/--base-dir` - (Optional) Directory where source files are located. Defaults to the current directory\n - `-e/--excludes` - (Optional) Comma-separated list of regexes of packages to exclude\n - `-o/--output` - (Optional) Path to store cobertura xml file. _Defaults to ./coverage.xml_\n - `-d/--demangle` - (Optional) Demangle C++ function names. _Requires c++filt_\n\n```bash\npython lcov_cobertura.py lcov-file.dat --base-dir src/dir --excludes test.lib --output build/coverage.xml --demangle\n```\n \n## With [pip](http://pypi.python.org/pypi/pip):\n```bash\npip install lcov_cobertura\n```\n\n### Command-line usage\n```bash\nlcov_cobertura lcov-file.dat\n```\n\n - `-b/--base-dir` - (Optional) Directory where source files are located. Defaults to the current directory\n - `-e/--excludes` - (Optional) Comma-separated list of regexes of packages to exclude\n - `-o/--output` - (Optional) Path to store cobertura xml file. _Defaults to ./coverage.xml_\n - `-d/--demangle` - (Optional) Demangle C++ function names. _Requires c++filt_\n\n```bash\nlcov_cobertura lcov-file.dat --base-dir src/dir --excludes test.lib --output build/coverage.xml --demangle\n```\n\n### Usage as a Python module\n\nUse it anywhere in your python:\n```python\nfrom lcov_cobertura import LcovCobertura\n\nLCOV_INPUT = 'SF:foo/file.ext\\nDA:1,1\\nDA:2,0\\nend_of_record\\n'\nconverter = LcovCobertura(LCOV_INPUT)\ncobertura_xml = converter.convert()\nprint(cobertura_xml)\n```\n\n## Environment Support\n\nPython 3.8+ is supported. The last release with Python 2.x support is [version 1.6](https://pypi.org/project/lcov_cobertura/1.6/). \n\n## Contributions\nThis project is made possible due to the efforts of these fine people:\n\n - [Eric Wendelin](https://eriwen.com)\n - [Bj\u00f6rge Dijkstra](https://github.com/bjd)\n - [Jon Schewe](http://mtu.net/~jpschewe)\n - [Yury V. Zaytsev](http://yury.zaytsev.net)\n - [Steve Arnold](https://github.com/sarnold)\n\n## License\nThis project is provided under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "LCOV to Cobertura XML converter",
"version": "2.1.1",
"project_urls": {
"Download": "https://raw.githubusercontent.com/eriwen/lcov-to-cobertura-xml/master/lcov_cobertura/lcov_cobertura.py",
"Homepage": "https://eriwen.github.io/lcov-to-cobertura-xml/"
},
"split_keywords": [
"lcov",
" cobertura"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "787a9b1448f18172e7034f1dcc717d804a86430cbd24fc7c38782a800bf3faae",
"md5": "ab7c0f1c8a438c7657de78e62f368222",
"sha256": "92f8107297f6d1d7a7a0a88c6071c1ea04f862f2fe918c6ecce271573c37d8aa"
},
"downloads": -1,
"filename": "lcov_cobertura-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ab7c0f1c8a438c7657de78e62f368222",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12287,
"upload_time": "2025-02-22T17:42:35",
"upload_time_iso_8601": "2025-02-22T17:42:35.801399Z",
"url": "https://files.pythonhosted.org/packages/78/7a/9b1448f18172e7034f1dcc717d804a86430cbd24fc7c38782a800bf3faae/lcov_cobertura-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "7bd064bda2ec25aff095a1adb41fdab22bc467e63d1cc5a8c5130ac2bf444b88",
"md5": "c272259fc1873c7d72a3229d4f8ea236",
"sha256": "efa8e264f2bddebb7f5024e4ace12b633d9d59048bc647427d1e1b9688c8b58f"
},
"downloads": -1,
"filename": "lcov_cobertura-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c272259fc1873c7d72a3229d4f8ea236",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 31125,
"upload_time": "2025-02-22T17:42:36",
"upload_time_iso_8601": "2025-02-22T17:42:36.784490Z",
"url": "https://files.pythonhosted.org/packages/7b/d0/64bda2ec25aff095a1adb41fdab22bc467e63d1cc5a8c5130ac2bf444b88/lcov_cobertura-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-22 17:42:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "lcov-cobertura"
}