Reporting

Coverage.py provides a few styles of reporting, with the report, html, json, lcov, xml, and annotate commands. They share a number of common options.

The command-line arguments are module or file names to report on if you’d like to report on a subset of the data collected.

The --include and --omit flags specify lists of file name patterns. They control which files to report on, and are described in more detail in Specifying source files.

The -i or --ignore-errors switch tells coverage.py to ignore problems encountered trying to find source files to report on. This can be useful if some files are missing, or if your Python execution is tricky enough that file names are synthesized without real source files.

If you provide a --fail-under value, the total percentage covered will be compared to that value. If it is less, the command will exit with a status code of 2, indicating that the total coverage was less than your target. This can be used as part of a pass/fail condition, for example in a continuous integration server. This option isn’t available for annotate.

These options can also be set in your .coveragerc file. See Configuration: [report].