File: api.rst

package info (click to toggle)
python-coverage 4.5.2%2Bdfsg.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,524 kB
  • sloc: python: 17,968; ansic: 1,212; makefile: 182; sh: 133; xml: 42
file content (43 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download | duplicates (2)
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
.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
.. For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt

.. _api:

===============
Coverage.py API
===============

.. :history: 20090524T134300, brand new docs.
.. :history: 20090613T164000, final touches for 3.0
.. :history: 20100221T151500, docs for 3.3 (on the plane back from PyCon)
.. :history: 20100725T211700, updated for 3.4.
.. :history: 20121111T235800, added a bit of clarification.
.. :history: 20140819T132600, change class name to Coverage


The API to coverage.py is very simple, contained in a module called `coverage`.
Most of the interface is in the :class:`coverage.Coverage` class.  Methods on
the Coverage object correspond roughly to operations available in the command
line interface. For example, a simple use would be::

    import coverage

    cov = coverage.Coverage()
    cov.start()

    # .. call your code ..

    cov.stop()
    cov.save()

    cov.html_report()

The :class:`coverage.CoverageData` class provides access to coverage data
stored in coverage.py data files.

.. toctree::
    :maxdepth: 1

    api_coverage
    api_coveragedata
    api_plugin