summaryrefslogtreecommitdiff
path: root/doc/en/test/plugin/coverage.rst
blob: 71139d008ba020a7f7b696a23c842c3f533ddc52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

Write and report coverage data with the 'coverage' package.
===========================================================


.. contents::
  :local:

Note: Original code by Ross Lawley. 

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::

    pytest --cover-report=report

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.
                    xml: Output an xml report compatible with the cobertura plugin for hudson.
``--cover-directory=DIRECTORY``
    Directory for the reports (html / annotate results) defaults to ./coverage
``--cover-xml-file=XML_FILE``
    File for the xml report defaults to ./coverage.xml
``--cover-show-missing``
    Show missing files
``--cover-ignore-errors=IGNORE_ERRORS``
    Ignore errors of finding source files for code.

.. include:: links.txt