Skip to content

coverage

coverage documentation

footman._stubs.coverage.Coverage

Bases: Tool

__call__

__call__(*args: str, **flags: Any) -> Result

Coverage.py, version 7.15.2 with C extension

annotate

annotate(
    *args: str,
    data_file: _Value = ...,
    debug: _Value = ...,
    directory: _Value = ...,
    ignore_errors: _Flag = ...,
    include: _Value = ...,
    keep_combined: _Flag = ...,
    omit: _Value = ...,
    rcfile: _Value = ...,
    **flags: Any,
) -> Result

Make annotated copies of the given files, marking statements that are executed with > and statements that are missed with !.

Parameters:

Name Type Description Default
data_file _Value

Read coverage data for report generation from this file.

...
debug _Value

Debug options, separated by commas.

...
directory _Value

Write the output files to DIR.

...
ignore_errors _Flag

Ignore errors while reading source files.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
keep_combined _Flag

Keep original coverage files, otherwise they are deleted after combining.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
rcfile _Value

Specify configuration file.

...

combine

combine(
    *args: str,
    append: _Flag = ...,
    data_file: _Value = ...,
    debug: _Value = ...,
    keep: _Flag = ...,
    quiet: _Flag = ...,
    rcfile: _Value = ...,
    **flags: Any,
) -> Result

Combine data from multiple coverage files. The combined results are written to a single file representing the union of the data. The positional arguments are data files or directories containing

Parameters:

Name Type Description Default
append _Flag

Append data to the data file.

...
data_file _Value

Base name of the data files to operate on.

...
debug _Value

Debug options, separated by commas.

...
keep _Flag

Keep original coverage files, otherwise they are deleted.

...
quiet _Flag

Don't print messages about what is happening.

...
rcfile _Value

Specify configuration file.

...

erase

erase(
    *,
    data_file: _Value = ...,
    debug: _Value = ...,
    rcfile: _Value = ...,
    **flags: Any,
) -> Result

Erase previously collected coverage data.

Parameters:

Name Type Description Default
data_file _Value

Base name of the data files to operate on.

...
debug _Value

Debug options, separated by commas.

...
rcfile _Value

Specify configuration file.

...

flags

flags(**flags: Any) -> Coverage

Bind tool-level global options before the subcommand.

tools.docker.flags(host=...) puts a tool's own options ahead of the verb, where they belong.

html

html(
    *args: str,
    contexts: _Value = ...,
    data_file: _Value = ...,
    debug: _Value = ...,
    directory: _Value = ...,
    fail_under: _Value = ...,
    ignore_errors: _Flag = ...,
    include: _Value = ...,
    keep_combined: _Flag = ...,
    omit: _Value = ...,
    precision: _Value = ...,
    quiet: _Flag = ...,
    rcfile: _Value = ...,
    show_contexts: _Flag = ...,
    skip_covered: _Flag = ...,
    skip_empty: _Flag = ...,
    title: _Value = ...,
    **flags: Any,
) -> Result

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

Parameters:

Name Type Description Default
contexts _Value

Only display data from lines covered in the given contexts. May be repeated: a list emits the flag once per item.

...
data_file _Value

Read coverage data for report generation from this file.

...
debug _Value

Debug options, separated by commas.

...
directory _Value

Write the output files to DIR.

...
fail_under _Value

Exit with a status of 2 if the total coverage is less than MIN.

...
ignore_errors _Flag

Ignore errors while reading source files.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
keep_combined _Flag

Keep original coverage files, otherwise they are deleted after combining.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
precision _Value

Number of digits after the decimal point to display for reported coverage percentages.

...
quiet _Flag

Don't print messages about what is happening.

...
rcfile _Value

Specify configuration file.

...
show_contexts _Flag

Show contexts for covered lines.

...
skip_covered _Flag

Skip files with 100% coverage. skip_covered=off emits --no-skip-covered.

...
skip_empty _Flag

Skip files with no code.

...
title _Value

A text string to use as the title on the HTML.

...

json

json(
    *args: str,
    contexts: _Value = ...,
    data_file: _Value = ...,
    debug: _Value = ...,
    fail_under: _Value = ...,
    ignore_errors: _Flag = ...,
    include: _Value = ...,
    keep_combined: _Flag = ...,
    o: _Value = ...,
    omit: _Value = ...,
    pretty_print: _Flag = ...,
    quiet: _Flag = ...,
    rcfile: _Value = ...,
    show_contexts: _Flag = ...,
    **flags: Any,
) -> Result

Generate a JSON report of coverage results.

Parameters:

Name Type Description Default
contexts _Value

Only display data from lines covered in the given contexts. May be repeated: a list emits the flag once per item.

...
data_file _Value

Read coverage data for report generation from this file.

...
debug _Value

Debug options, separated by commas.

...
fail_under _Value

Exit with a status of 2 if the total coverage is less than MIN.

...
ignore_errors _Flag

Ignore errors while reading source files.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
keep_combined _Flag

Keep original coverage files, otherwise they are deleted after combining.

...
o _Value

Write the JSON report to this file.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
pretty_print _Flag

Format the JSON for human readers.

...
quiet _Flag

Don't print messages about what is happening.

...
rcfile _Value

Specify configuration file.

...
show_contexts _Flag

Show contexts for covered lines.

...

report

report(
    *args: str,
    contexts: _Value = ...,
    data_file: _Value = ...,
    debug: _Value = ...,
    fail_under: _Value = ...,
    format: _Value = ...,
    ignore_errors: _Flag = ...,
    include: _Value = ...,
    keep_combined: _Flag = ...,
    omit: _Value = ...,
    precision: _Value = ...,
    rcfile: _Value = ...,
    show_missing: _Flag = ...,
    skip_covered: _Flag = ...,
    skip_empty: _Flag = ...,
    sort: _Value = ...,
    **flags: Any,
) -> Result

Report coverage statistics on modules.

Parameters:

Name Type Description Default
contexts _Value

Only display data from lines covered in the given contexts. May be repeated: a list emits the flag once per item.

...
data_file _Value

Read coverage data for report generation from this file.

...
debug _Value

Debug options, separated by commas.

...
fail_under _Value

Exit with a status of 2 if the total coverage is less than MIN.

...
format _Value

Output format, either text (default), markdown, or total.

...
ignore_errors _Flag

Ignore errors while reading source files.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
keep_combined _Flag

Keep original coverage files, otherwise they are deleted after combining.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
precision _Value

Number of digits after the decimal point to display for reported coverage percentages.

...
rcfile _Value

Specify configuration file.

...
show_missing _Flag

Show line numbers of statements in each module that weren't executed.

...
skip_covered _Flag

Skip files with 100% coverage. skip_covered=off emits --no-skip-covered.

...
skip_empty _Flag

Skip files with no code.

...
sort _Value

Sort the report by the named column: name, stmts, miss, branch, brpart, or cover.

...

run

run(
    pyfile: str,
    /,
    *args: str,
    append: _Flag = ...,
    branch: _Flag = ...,
    concurrency: _Value = ...,
    context: _Value = ...,
    data_file: _Value = ...,
    debug: _Value = ...,
    include: _Value = ...,
    module: _Flag = ...,
    omit: _Value = ...,
    parallel_mode: _Flag = ...,
    pylib: _Flag = ...,
    rcfile: _Value = ...,
    save_signal: _Value = ...,
    source: _Value = ...,
    timid: _Flag = ...,
    **flags: Any,
) -> Result

Run a Python program, measuring code execution.

Parameters:

Name Type Description Default
append _Flag

Append data to the data file.

...
branch _Flag

Measure branch coverage in addition to statement coverage.

...
concurrency _Value

Properly measure code using a concurrency library.

...
context _Value

The context label to record for this coverage run.

...
data_file _Value

Write the recorded coverage data to this file.

...
debug _Value

Debug options, separated by commas.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
module _Flag

is an importable Python module, not a script path, to be run as 'python -m' would run it.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
parallel_mode _Flag

Append a unique suffix to the data file name to collect separate data from multiple processes.

...
pylib _Flag

Measure coverage even inside the Python installed library, which isn't done by default.

...
rcfile _Value

Specify configuration file.

...
save_signal _Value

Specify a signal that will trigger coverage to write its collected data.

...
source _Value

A list of directories or importable names of code to measure. May be repeated: a list emits the flag once per item.

...
timid _Flag

Use the slower Python trace function core.

...

xml

xml(
    *args: str,
    data_file: _Value = ...,
    debug: _Value = ...,
    fail_under: _Value = ...,
    ignore_errors: _Flag = ...,
    include: _Value = ...,
    keep_combined: _Flag = ...,
    o: _Value = ...,
    omit: _Value = ...,
    quiet: _Flag = ...,
    rcfile: _Value = ...,
    skip_empty: _Flag = ...,
    **flags: Any,
) -> Result

Generate an XML report of coverage results.

Parameters:

Name Type Description Default
data_file _Value

Read coverage data for report generation from this file.

...
debug _Value

Debug options, separated by commas.

...
fail_under _Value

Exit with a status of 2 if the total coverage is less than MIN.

...
ignore_errors _Flag

Ignore errors while reading source files.

...
include _Value

Include only files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
keep_combined _Flag

Keep original coverage files, otherwise they are deleted after combining.

...
o _Value

Write the XML report to this file.

...
omit _Value

Omit files whose paths match one of these patterns. May be repeated: a list emits the flag once per item.

...
quiet _Flag

Don't print messages about what is happening.

...
rcfile _Value

Specify configuration file.

...
skip_empty _Flag

Skip files with no code.

...