use case

How to view Python coverage.py reports as LCOV

Convert a Python coverage.py report to LCOV format and view it online.

Python's coverage.py tool can export reports in LCOV format since version 6.3. This lets you view Python coverage data in the same tools used for JavaScript and C++ projects. This guide explains how to generate the LCOV file from a Python project using pytest-cov or coverage.py, then view it without installing any additional software.

Step-by-step guide

  1. Run pytest with LCOV output: Install pytest-cov and run: pytest --cov=src --cov-report=lcov:coverage.lcov. The file coverage.lcov is created in your project root.
  2. Upload the .lcov file: Open quickhelp.dev/lcov-viewer and upload coverage.lcov. The viewer accepts both .info and .lcov file extensions — they use the same format.
  3. Read coverage by module: Python module paths (e.g., src/auth/tokens.py) appear in the file table. Low-coverage modules show red or yellow indicators — sort by coverage to prioritize test writing.

Frequently asked questions

Does coverage.py support LCOV output natively?
Yes, since version 6.3. Run coverage lcov -o coverage.lcov after coverage run. Or configure it in .coveragerc: [report] format = lcov.
What if my .lcov file is very large?
The viewer processes files entirely in JavaScript in your browser. Files up to a few megabytes parse quickly. For extremely large monorepo reports, parsing may take a few seconds.

Try it now

Use the LCOV Coverage Viewer to complete this task — free, no sign-up, runs in your browser.

Open LCOV Coverage Viewer

We use cookies to serve ads and measure traffic. Cookie policy · Privacy policy