PYTHON-COVERAGE(1)
π 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 of2if 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 of2if 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.coveragedata 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 of2if 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 tocoverage.xml.
π¦ ENVIRONMENT VARIABLES π¦
COVERAGE_FILEβ path to the file where coverage measurements are collected to and reported from. default:.coveragein the current working directory.COVERAGE_OPTIONSβ space-separated series of command-line options topython-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 π
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
- ubuntu noble: python3-coverage 7.4.4+dfsg1-0ubuntu2 Β· Apache-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms