coverage¶
Coverage ¶
Bases: Tool[_R]
Classes:
| Name | Description |
|---|---|
Annotate |
|
Combine |
|
Erase |
|
Html |
|
Json |
|
Report |
|
Run |
|
Xml |
|
Methods:
| Name | Description |
|---|---|
__call__ |
Coverage.py, version 7.15.4 with C extension |
flags |
Bind tool-level global options before the subcommand. |
Attributes:
| Name | Type | Description |
|---|---|---|
annotate |
Annotate[_R]
|
|
combine |
Combine[_R]
|
|
erase |
Erase[_R]
|
|
html |
Html[_R]
|
|
json |
Json[_R]
|
|
report |
Report[_R]
|
|
run |
Run[_R]
|
|
xml |
Xml[_R]
|
|
argv |
Coverage[Argv]
|
|
Annotate ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Make annotated copies of the given files, marking statements that are |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Annotate[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[str], data_file: Value = ..., debug: Value = ..., directory: Value = ..., ignore_errors: Flag = ..., include: Value = ..., keep_combined: Flag = ..., omit: Value = ..., rcfile: Value = ..., **flags: Any) -> _R2
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. Added in 7.15.0. |
...
|
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 ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Combine data from multiple coverage files. The combined results are |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Combine[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[str], append: Flag = ..., data_file: Value = ..., debug: Value = ..., keep: Flag = ..., quiet: Flag = ..., rcfile: Value = ..., **flags: Any) -> _R2
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 ¶
Html ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Create an HTML report of coverage results. Each file gets its own page, |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Html[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[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) -> _R2
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. Added in 7.15.0. |
...
|
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_empty
|
Flag
|
Skip files with no code. |
...
|
title
|
Value
|
A text string to use as the title on the HTML. |
...
|
Json ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Generate a JSON report of coverage results. |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Json[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[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) -> _R2
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. Added in 7.15.0. |
...
|
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 ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Report coverage statistics on modules. |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Report[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[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) -> _R2
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. Added in 7.15.0. |
...
|
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_empty
|
Flag
|
Skip files with no code. |
...
|
sort
|
Value
|
Sort the report by the named column: name, stmts, miss, branch, brpart, or cover. |
...
|
Run ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Run a Python program, measuring code execution. |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Run[Argv]
|
|
__call__ ¶
__call__(pyfile: str | PathLike[str], /, *args: str | PathLike[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) -> _R2
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
|
|
...
|
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 ¶
Bases: Tool[_R2]
Methods:
| Name | Description |
|---|---|
__call__ |
Generate an XML report of coverage results. |
Attributes:
| Name | Type | Description |
|---|---|---|
argv |
Xml[Argv]
|
|
__call__ ¶
__call__(*args: str | PathLike[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) -> _R2
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. Added in 7.15.0. |
...
|
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. |
...
|
__call__ ¶
Coverage.py, version 7.15.4 with C extension