Scroll to navigation

PYTHON-COVERAGE(1) Coverage PYTHON-COVERAGE(1)

NAME

python-coverage - measure code coverage of Python program execution

SYNOPSIS

python-coverage command [ option ... ]
python-coverage help [ command ]

DESCRIPTION

python-coverage executes a Python program, measures which of its statements are executed and which are not, and reports these coverage measurements.

COMMAND OVERVIEW

Annotate source files with execution information.
Combine a number of data files.
Display diagnostic information about the internals of this program.
Erase previously collected coverage data.
Get help on using coverage.py.
Create an HTML report.
Report coverage stats on modules.
Run a Python program and measure code execution.
Create an XML report of coverage results.

GLOBAL OPTIONS

Describe how to use Coverage, in general or a command.
Specify configuration file RCFILE. Defaults to .coveragerc.
Omit files when their filename matches one of these PATTERNs. Usually needs quoting on the command line.
Include files only when their filename path matches one of these PATTERNs. Usually needs quoting on the command line.

COMMAND REFERENCE

annotate

Options:
Write the output files to DIR.
Ignore errors while reading source files.



combine PATH PATH [ ... ]

Combine data from multiple coverage files PATH, collected with run -p. The combined results are written to a single file representing the union of the data.


debug topic

Display information on the internals of coverage.py, for diagnosing problems.

Topics are:

  • data, to show a summary of the collected data.
  • sys, to show installation information.



erase

Erase previously collected coverage data.


help [ command ]

Describe how to use Coverage.


html [ option ... ] [ MODULE ... ]

Create an HTML report of the coverage of each MODULE file. Each file gets its own page, with the source decorated to show executed, excluded, and missed lines.

Options:

Write the output files to DIR.
Use the text string TITLE as the title on the HTML.
Exit with a status of 2 if the total coverage is less than MIN.
Ignore errors while reading source files.



report [ option ... ] [ MODULE ... ]

Report coverage statistics on each MODULE.

Options:

Exit with a status of 2 if the total coverage is less than MIN.
Ignore errors while reading source files.
Show line numbers of statements in each module that weren't executed.



run [ options ... ] PROGRAMFILE [ program_options ]

Run a Python program PROGRAMFILE, measuring code execution.

Options:

Append coverage data to .coverage, otherwise it is started clean with each run.
Measure branch coverage in addition to statement coverage.
Debug options DEBUGOPT, separated by commas
Measure coverage even inside the Python installed library, which isn't done by default.
Append the machine name, process id and random number to the .coverage data file name to simplify collecting data from many processes.
Use a simpler but slower trace method. Try this if you get seemingly impossible results!
A list of packages or directories of code to be measured.



xml [ options ... ] [ MODULES ... ]

Generate an XML report of coverage results on each MODULE.

Options:

Exit with a status of 2 if the total coverage is less than MIN.
Ignore errors while reading source files.
Write the XML report to OUTFILE. Defaults to coverage.xml.



ENVIRONMENT VARIABLES

COVERAGE_FILE

Path to the file where coverage measurements are collected to and reported from. Default: .coverage in the current working directory.


COVERAGE_OPTIONS

Space-separated series of command-line options to python-coverage. Default: empty.


HISTORY

The python-coverage command is a Python program which calls the coverage Python library to do all the work.

The library was originally developed by Gareth Rees, and is now developed by Ned Batchelder.

This manual page was written to document the python-coverage command for Debian. This is free software: you may copy, modify and/or distribute this work under the terms of the GNU General Public License, version 3 or later as published by the Free Software Foundation, version 3 or later. No warranty expressed or implied.

On Debian systems, the complete text of the GNU General Public License version 3 can be found in the file /usr/share/common-licenses/GPL-3.

AUTHOR

Ben Finney <ben+python@benfinney.id.au>

COPYRIGHT

Copyright © 2010–2017 Ben Finney <bignose@debian.org>

2017-09-08