2009-11-05 10:18:55 +08:00
|
|
|
|
2010-04-12 22:08:12 +08:00
|
|
|
Write and report coverage data with the 'coverage' package.
|
|
|
|
===========================================================
|
2009-11-05 10:18:55 +08:00
|
|
|
|
|
|
|
|
2010-04-12 22:08:12 +08:00
|
|
|
.. contents::
|
|
|
|
:local:
|
2009-11-05 10:18:55 +08:00
|
|
|
|
2010-09-14 23:35:01 +08:00
|
|
|
Note: Original code by Ross Lawley.
|
2010-04-12 22:08:12 +08:00
|
|
|
|
2010-09-14 23:35:01 +08:00
|
|
|
Install
|
|
|
|
--------------
|
|
|
|
|
|
|
|
Use pip to (un)install::
|
|
|
|
|
|
|
|
pip install pytest-coverage
|
|
|
|
pip uninstall pytest-coverage
|
|
|
|
|
|
|
|
or alternatively use easy_install to install::
|
|
|
|
|
|
|
|
easy_install pytest-coverage
|
|
|
|
|
|
|
|
|
|
|
|
Usage
|
|
|
|
-------------
|
|
|
|
|
|
|
|
To get full test coverage reports for a particular package type::
|
|
|
|
|
2016-06-21 22:16:57 +08:00
|
|
|
pytest --cover-report=report
|
2010-04-12 22:08:12 +08:00
|
|
|
|
|
|
|
command line options
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
|
|
|
|
``--cover=COVERPACKAGES``
|
|
|
|
(multi allowed) only include info from specified package.
|
|
|
|
``--cover-report=REPORT_TYPE``
|
|
|
|
html: Directory for html output.
|
|
|
|
report: Output a text report.
|
|
|
|
annotate: Annotate your source code for which lines were executed and which were not.
|
2010-09-14 23:35:01 +08:00
|
|
|
xml: Output an xml report compatible with the cobertura plugin for hudson.
|
2010-04-12 22:08:12 +08:00
|
|
|
``--cover-directory=DIRECTORY``
|
|
|
|
Directory for the reports (html / annotate results) defaults to ./coverage
|
2010-09-14 23:35:01 +08:00
|
|
|
``--cover-xml-file=XML_FILE``
|
|
|
|
File for the xml report defaults to ./coverage.xml
|
2010-04-12 22:08:12 +08:00
|
|
|
``--cover-show-missing``
|
|
|
|
Show missing files
|
|
|
|
``--cover-ignore-errors=IGNORE_ERRORS``
|
|
|
|
Ignore errors of finding source files for code.
|
|
|
|
|
|
|
|
.. include:: links.txt
|