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