OLD | NEW |
(Empty) | |
| 1 .. _api: |
| 2 |
| 3 ============ |
| 4 Coverage API |
| 5 ============ |
| 6 |
| 7 :history: 20090524T134300, brand new docs. |
| 8 :history: 20090613T164000, final touches for 3.0 |
| 9 :history: 20100221T151500, docs for 3.3 (on the plane back from PyCon) |
| 10 :history: 20100725T211700, updated for 3.4. |
| 11 :history: 20121111T235800, added a bit of clarification. |
| 12 |
| 13 |
| 14 The API to coverage.py is very simple, contained in a single module called |
| 15 `coverage`. Most of the interface is in a single class, also called |
| 16 `coverage`. Methods on the coverage object correspond roughly to operations ava
ilable |
| 17 in the command line interface. For example, a simple use would be:: |
| 18 |
| 19 import coverage |
| 20 |
| 21 cov = coverage.coverage() |
| 22 cov.start() |
| 23 |
| 24 # .. call your code .. |
| 25 |
| 26 cov.stop() |
| 27 cov.save() |
| 28 |
| 29 cov.html_report() |
| 30 |
| 31 |
| 32 The coverage module |
| 33 ------------------- |
| 34 |
| 35 .. module:: coverage |
| 36 |
| 37 .. autoclass:: coverage |
| 38 :members: |
| 39 |
| 40 |
| 41 Starting coverage automatically |
| 42 ------------------------------- |
| 43 |
| 44 This function is used to start coverage measurement automatically when Python |
| 45 starts. See :ref:`subprocess` for details. |
| 46 |
| 47 .. autofunction:: process_startup |
OLD | NEW |