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

Side by Side Diff: tools/telemetry/third_party/coverage/doc/source.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 .. _source:
5
6 =======================
7 Specifying source files
8 =======================
9
10 .. :history: 20100725T172000, new in 3.4
11
12
13 When coverage.py is running your program and measuring its execution, it needs
14 to know what code to measure and what code not to. Measurement imposes a speed
15 penalty, and the collected data must be stored in memory and then on disk.
16 More importantly, when reviewing your coverage reports, you don't want to be
17 distracted with modules that aren't your concern.
18
19 Coverage.py has a number of ways you can focus it in on the code you care
20 about.
21
22
23 .. _source_execution:
24
25 Execution
26 ---------
27
28 When running your code, the ``coverage run`` command will by default measure
29 all code, unless it is part of the Python standard library.
30
31 You can specify source to measure with the ``--source`` command-line switch, or
32 the ``[run] source`` configuration value. The value is a list of directories
33 or package names. If specified, only source inside these directories or
34 packages will be measured. Specifying the source option also enables
35 coverage.py to report on unexecuted files, since it can search the source tree
36 for files that haven't been measured at all. Only importable files (ones at
37 the root of the tree, or in directories with a ``__init__.py`` file) will be
38 considered, and files with unusual punctuation in their names will be skipped
39 (they are assumed to be scratch files written by text editors).
40
41 You can further fine-tune coverage.py's attention with the ``--include`` and
42 ``--omit`` switches (or ``[run] include`` and ``[run] omit`` configuration
43 values). ``--include`` is a list of file name patterns. If specified, only
44 files matching those patterns will be measured. ``--omit`` is also a list of
45 file name patterns, specifying files not to measure. If both ``include`` and
46 ``omit`` are specified, first the set of files is reduced to only those that
47 match the include patterns, then any files that match the omit pattern are
48 removed from the set.
49
50 The ``include`` and ``omit`` file name patterns follow typical shell syntax:
51 ``*`` matches any number of characters and ``?`` matches a single character.
52 Patterns that start with a wildcard character are used as-is, other patterns
53 are interpreted relative to the current directory.
54
55 The ``source``, ``include``, and ``omit`` values all work together to determine
56 the source that will be measured.
57
58
59 .. _source_reporting:
60
61 Reporting
62 ---------
63
64 Once your program is measured, you can specify the source files you want
65 reported. Usually you want to see all the code that was measured, but if you
66 are measuring a large project, you may want to get reports for just certain
67 parts.
68
69 The report commands (``report``, ``html``, ``annotate``, and ``xml``) all take
70 optional ``modules`` arguments, and ``--include`` and ``--omit`` switches. The
71 ``modules`` arguments specify particular modules to report on. The ``include``
72 and ``omit`` values are lists of file name patterns, just as with the ``run``
73 command.
74
75 Remember that the reporting commands can only report on the data that has been
76 collected, so the data you're looking for may not be in the data available for
77 reporting.
78
79 Note that these are ways of specifying files to measure. You can also exclude
80 individual source lines. See :ref:`excluding` for details.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698