OLD | NEW |
| (Empty) |
1 .. _faq: | |
2 | |
3 ================== | |
4 FAQ and other help | |
5 ================== | |
6 | |
7 :history: 20090613T141800, brand new docs. | |
8 :history: 20091005T073900, updated for 3.1. | |
9 :history: 20091127T201500, updated for 3.2. | |
10 :history: 20110605T175500, add the announcement mailing list. | |
11 :history: 20121231T104700, Tweak the py3 text. | |
12 | |
13 | |
14 Frequently asked questions | |
15 -------------------------- | |
16 | |
17 **Q: I use nose to run my tests, and its cover plugin doesn't let me create | |
18 HTML or XML reports. What should I do?** | |
19 | |
20 First run your tests and collect coverage data with `nose`_ and its plugin. | |
21 This will write coverage data into a .coverage file. Then run coverage.py from | |
22 the :ref:`command line <cmd>` to create the reports you need from that data. | |
23 | |
24 .. _nose: http://somethingaboutorange.com/mrl/projects/nose | |
25 | |
26 | |
27 **Q: Why do unexecutable lines show up as executed?** | |
28 | |
29 Usually this is because you've updated your code and run coverage on it | |
30 again without erasing the old data. Coverage records line numbers executed, so | |
31 the old data may have recorded a line number which has since moved, causing | |
32 coverage to claim a line has been executed which cannot be. | |
33 | |
34 If you are using the ``-x`` command line action, it doesn't erase first by | |
35 default. Switch to the ``coverage run`` command, or use the ``-e`` switch to | |
36 erase all data before starting the next run. | |
37 | |
38 | |
39 **Q: Why do the bodies of functions (or classes) show as executed, but the def | |
40 lines do not?** | |
41 | |
42 This happens because coverage is started after the functions are defined. The | |
43 definition lines are executed without coverage measurement, then coverage is | |
44 started, then the function is called. This means the body is measured, but | |
45 the definition of the function itself is not. | |
46 | |
47 To fix this, start coverage earlier. If you use the :ref:`command line <cmd>` | |
48 to run your program with coverage, then your entire program will be monitored. | |
49 If you are using the :ref:`API <api>`, you need to call coverage.start() before | |
50 importing the modules that define your functions. | |
51 | |
52 | |
53 **Q: Does coverage.py work on Python 3.x?** | |
54 | |
55 Yes, Python 3 is fully supported. | |
56 | |
57 | |
58 **Q: Isn't coverage testing the best thing ever?** | |
59 | |
60 It's good, but `it isn't perfect`__. | |
61 | |
62 __ http://nedbatchelder.com/blog/200710/flaws_in_coverage_measurement.html | |
63 | |
64 | |
65 .. Other resources | |
66 --------------- | |
67 | |
68 There are a number of projects that help integrate coverage.py into other | |
69 systems: | |
70 | |
71 - `trialcoverage`_ is a plug-in for Twisted trial. | |
72 | |
73 .. _trialcoverage: http://pypi.python.org/pypi/trialcoverage | |
74 | |
75 - `pytest-coverage`_ | |
76 | |
77 .. _pytest-coverage: http://pypi.python.org/pypi/pytest-coverage | |
78 | |
79 - `django-coverage`_ for use with Django. | |
80 | |
81 .. _django-coverage: http://pypi.python.org/pypi/django-coverage | |
82 | |
83 | |
84 **Q: Where can I get more help with coverage.py?** | |
85 | |
86 You can discuss coverage.py or get help using it on the `Testing In Python`_ | |
87 mailing list. | |
88 | |
89 .. _Testing In Python: http://lists.idyll.org/listinfo/testing-in-python | |
90 | |
91 Bug reports are gladly accepted at the `Bitbucket issue tracker`_. | |
92 | |
93 .. _Bitbucket issue tracker: http://bitbucket.org/ned/coveragepy/issues | |
94 | |
95 Announcements of new coverage.py releases are sent to the | |
96 `coveragepy-announce`_ mailing list. | |
97 | |
98 .. _coveragepy-announce: http://groups.google.com/group/coveragepy-announce | |
99 | |
100 `I can be reached`__ in a number of ways, I'm happy to answer questions about | |
101 using coverage.py. I'm also available hourly for consultation or custom | |
102 development. | |
103 | |
104 __ http://nedbatchelder.com/site/aboutned.html | |
105 | |
106 | |
107 History | |
108 ------- | |
109 | |
110 Coverage.py was originally written by `Gareth Rees`_. | |
111 Since 2004, `Ned Batchelder`_ has extended and maintained it with the help of | |
112 `many others`_. The :ref:`change history <changes>` has all the details. | |
113 | |
114 .. _Gareth Rees: http://garethrees.org/ | |
115 .. _Ned Batchelder: http://nedbatchelder.com | |
116 .. _many others: http://bitbucket.org/ned/coveragepy/src/tip/AUTHORS.txt | |
OLD | NEW |