Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(334)

Side by Side Diff: tools/telemetry/third_party/coverage/doc/faq.rst

Issue 1366913004: Add coverage Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 .. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
2 .. For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
3
4 .. _faq:
5
6 ==================
7 FAQ and other help
8 ==================
9
10 .. :history: 20090613T141800, brand new docs.
11 .. :history: 20091005T073900, updated for 3.1.
12 .. :history: 20091127T201500, updated for 3.2.
13 .. :history: 20110605T175500, add the announcement mailing list.
14 .. :history: 20121231T104700, Tweak the py3 text.
15
16
17 Frequently asked questions
18 --------------------------
19
20 **Q: I use nose to run my tests, and its cover plugin doesn't let me create
21 HTML or XML reports. What should I do?**
22
23 First run your tests and collect coverage data with `nose`_ and its plugin.
24 This will write coverage data into a .coverage file. Then run coverage.py from
25 the :ref:`command line <cmd>` to create the reports you need from that data.
26
27 .. _nose: http://somethingaboutorange.com/mrl/projects/nose
28
29
30 **Q: Why do unexecutable lines show up as executed?**
31
32 Usually this is because you've updated your code and run coverage.py on it
33 again without erasing the old data. Coverage.py records line numbers executed,
34 so the old data may have recorded a line number which has since moved, causing
35 coverage.py to claim a line has been executed which cannot be.
36
37 If you are using the ``-x`` command line action, it doesn't erase first by
38 default. Switch to the ``coverage run`` command, or use the ``-e`` switch to
39 erase all data before starting the next run.
40
41
42 **Q: Why do the bodies of functions (or classes) show as executed, but the def
43 lines do not?**
44
45 This happens because coverage.py is started after the functions are defined.
46 The definition lines are executed without coverage measurement, then
47 coverage.py is started, then the function is called. This means the body is
48 measured, but the definition of the function itself is not.
49
50 To fix this, start coverage.py earlier. If you use the :ref:`command line
51 <cmd>` to run your program with coverage.py, then your entire program will be
52 monitored. If you are using the :ref:`API <api>`, you need to call
53 coverage.start() before importing the modules that define your functions.
54
55
56 **Q: Coverage.py is much slower than I remember, what's going on?**
57
58 Make sure you are using the C trace function. Coverage.py provides two
59 implementations of the trace function. The C implementation runs much faster.
60 To see what you are running, use ``coverage debug sys``. The output contains
61 details of the environment, including a line that says either ``tracer: CTracer` `
62 or ``tracer: PyTracer``. If it says ``PyTracer`` then you are using the
63 slow Python implementation.
64
65 Try re-installing coverage.py to see what happened and if you get the CTracer
66 as you should.
67
68
69 **Q: Does coverage.py work on Python 3.x?**
70
71 Yes, Python 3 is fully supported.
72
73
74 **Q: Isn't coverage testing the best thing ever?**
75
76 It's good, but `it isn't perfect`__.
77
78 __ http://nedbatchelder.com/blog/200710/flaws_in_coverage_measurement.html
79
80
81 .. Other resources
82 ---------------
83
84 There are a number of projects that help integrate coverage.py into other
85 systems:
86
87 - `trialcoverage`_ is a plug-in for Twisted trial.
88
89 .. _trialcoverage: http://pypi.python.org/pypi/trialcoverage
90
91 - `pytest-coverage`_
92
93 .. _pytest-coverage: http://pypi.python.org/pypi/pytest-coverage
94
95 - `django-coverage`_ for use with Django.
96
97 .. _django-coverage: http://pypi.python.org/pypi/django-coverage
98
99
100 **Q: Where can I get more help with coverage.py?**
101
102 You can discuss coverage.py or get help using it on the `Testing In Python`_
103 mailing list.
104
105 .. _Testing In Python: http://lists.idyll.org/listinfo/testing-in-python
106
107 Bug reports are gladly accepted at the `Bitbucket issue tracker`_.
108
109 .. _Bitbucket issue tracker: http://bitbucket.org/ned/coveragepy/issues
110
111 Announcements of new coverage.py releases are sent to the
112 `coveragepy-announce`_ mailing list.
113
114 .. _coveragepy-announce: http://groups.google.com/group/coveragepy-announce
115
116 `I can be reached`__ in a number of ways, I'm happy to answer questions about
117 using coverage.py.
118
119 __ http://nedbatchelder.com/site/aboutned.html
120
121
122 History
123 -------
124
125 Coverage.py was originally written by `Gareth Rees`_.
126 Since 2004, `Ned Batchelder`_ has extended and maintained it with the help of
127 `many others`_. The :ref:`change history <changes>` has all the details.
128
129 .. _Gareth Rees: http://garethrees.org/
130 .. _Ned Batchelder: http://nedbatchelder.com
131 .. _many others: http://bitbucket.org/ned/coveragepy/src/tip/AUTHORS.txt
OLDNEW
« no previous file with comments | « tools/telemetry/third_party/coverage/doc/excluding.rst ('k') | tools/telemetry/third_party/coverage/doc/howitworks.rst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698