PYTHON-COVERAGE(1)

πŸ“¦ version 6.5.0, in debian bookworm

πŸ’– PYTHON-COVERAGE πŸ’–

okay bestie, so this is the manual page for python-coverage β€” a Coverage tool, and it's literally the way you find out which lines of your Python actually ran and which ones were just... sitting there. no cap. πŸ¦‹


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

python-coverage runs a Python program, watches which of its statements get executed and which ones don't, and then reports all those coverage measurements back to you. it's giving "receipts for your test suite" and honestly? iconic. πŸ’…


πŸ‘‘ COMMAND OVERVIEW πŸ‘‘

  • python-coverage annotate β€” annotate source files with execution information.
  • python-coverage combine β€” combine a number of data files.
  • python-coverage debug β€” display diagnostic information about the internals of this program.
  • python-coverage erase β€” erase previously collected coverage data.
  • python-coverage help β€” get help on using coverage.py.
  • python-coverage html β€” create an HTML report.
  • python-coverage report β€” report coverage stats on modules.
  • python-coverage run β€” run a Python program and measure code execution.
  • python-coverage xml β€” create an XML report of coverage results.

🌈 GLOBAL OPTIONS 🌈

these ones are the main character options, they apply across the board 🫢

  • --help, -h β€” describes how to use Coverage, in general or for a specific command.
  • --rcfile RCFILE β€” specify configuration file RCFILE. defaults to .coveragerc.
  • --omit PATTERN ... β€” omit files when their filename matches one of these *PATTERN*s. usually needs quoting on the command line.
  • --include PATTERN ... β€” include files only when their filename path matches one of these *PATTERN*s. usually needs quoting on the command line. (yes it's the picky sibling of --omit, we love her πŸ’–)

πŸ’… COMMAND REFERENCE πŸ’…

annotate

Options:

  • -d DIR, --directory DIR β€” write the output files to DIR.
  • -i, --ignore-errors β€” ignore errors while reading source files.

combine PATH PATH [ ... ]

Combine data from multiple coverage files PATH, collected with run -p. the combined results get written to a single file representing the union of the data. union!! like a friend group merging gc's. πŸ”₯


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. gone. poof. ✨


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. so aesthetic honestly πŸŽ€

Options:

  • -d DIR, --directory DIR β€” write the output files to DIR.
  • --title TITLE β€” use the text string TITLE as the title on the HTML.
  • --fail-under MIN β€” exit with a status of 2 if the total coverage is less than MIN.
  • -i, --ignore-errors β€” ignore errors while reading source files.

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

Report coverage statistics on each MODULE.

Options:

  • --fail-under MIN β€” exit with a status of 2 if the total coverage is less than MIN.
  • -i, --ignore-errors β€” ignore errors while reading source files.
  • -m, --show-missing β€” show line numbers of statements in each module that weren't executed. (the "who ghosted me" report πŸ™ˆ)

run [ options ... ] PROGRAMFILE [ program_options ]

Run a Python program PROGRAMFILE, measuring code execution.

Options:

  • -a, --append β€” append coverage data to .coverage, otherwise it is started clean with each run.
  • --branch β€” measure branch coverage in addition to statement coverage.
  • --debug DEBUGOPT,... β€” debug options DEBUGOPT, separated by commas
  • -L, --pylib β€” measure coverage even inside the Python installed library, which isn't done by default.
  • -p, --parallel-mode β€” append the machine name, process id and random number to the .coverage data file name to simplify collecting data from many processes.
  • --timid β€” use a simpler but slower trace method. try this if you get seemingly impossible results! πŸ’€
  • --source SOURCE ... β€” 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:

  • --fail-under MIN β€” exit with a status of 2 if the total coverage is less than MIN.
  • -i, --ignore-errors β€” ignore errors while reading source files.
  • -o OUTFILE β€” 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. bestie is just the messenger, the library does the heavy lifting πŸ’ͺ

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. (fr fr, no warranty, read the license πŸ’œ)

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 Β© 2010–2017 Ben Finney <bignose@debian.org>


and that's the whole page bestie, you ate it πŸ’…βœ¨

this was python-coverage(1) from the Coverage manual, dated 2020-09-06. go forth and get that 100% coverage, you absolute legend πŸ‘‘πŸ¦‹πŸ’–

πŸ“¦ where this page comes from