OLD | NEW |
1 .. _cmd: | 1 .. _cmd: |
2 | 2 |
3 =========================== | 3 =========================== |
4 Coverage command line usage | 4 Coverage command line usage |
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: 20090913T084400, new command line syntax | 9 :history: 20090913T084400, new command line syntax |
10 :history: 20091004T170700, changes for 3.1 | 10 :history: 20091004T170700, changes for 3.1 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 You asked coverage.py to measure module XXX, but it was never imported by | 132 You asked coverage.py to measure module XXX, but it was never imported by |
133 your program. | 133 your program. |
134 | 134 |
135 * "No data was collected" | 135 * "No data was collected" |
136 | 136 |
137 Coverage.py ran your program, but didn't measure any lines as executed. | 137 Coverage.py ran your program, but didn't measure any lines as executed. |
138 This could be because you asked to measure only modules that never ran, | 138 This could be because you asked to measure only modules that never ran, |
139 or for other reasons. | 139 or for other reasons. |
140 | 140 |
| 141 .. _cmd_run_debug: |
| 142 |
| 143 The ``--debug`` option instructs coverage to log internal details of its |
| 144 operation, to help with diagnosing problems. It takes a comma-separated list |
| 145 of options, each indicating a facet of operation to log to stderr: |
| 146 |
| 147 * ``trace``: print every decision about whether to trace a file or not. For |
| 148 files not being traced, the reason is also given. |
| 149 |
| 150 * ``config``: before starting, dump all the :ref:`configuration <config>` |
| 151 values. |
| 152 |
| 153 * ``sys``: before starting, dump all the system and environment information, |
| 154 as with :ref:`coverage debug sys <cmd_debug>`. |
| 155 |
| 156 * ``dataio``: log when reading or writing any data file. |
| 157 |
| 158 * ``pid``: annotate all debug output with the process id. |
141 | 159 |
142 | 160 |
143 .. _cmd_datafile: | 161 .. _cmd_datafile: |
144 | 162 |
145 Data file | 163 Data file |
146 --------- | 164 --------- |
147 | 165 |
148 Coverage collects execution data in a file called ".coverage". If need be, you | 166 Coverage collects execution data in a file called ".coverage". If need be, you |
149 can set a new file name with the COVERAGE_FILE environment variable. | 167 can set a new file name with the COVERAGE_FILE environment variable. |
150 | 168 |
(...skipping 10 matching lines...) Expand all Loading... |
161 .. _cmd_combining: | 179 .. _cmd_combining: |
162 | 180 |
163 Combining data files | 181 Combining data files |
164 -------------------- | 182 -------------------- |
165 | 183 |
166 If you need to collect coverage data from different machines or processes, | 184 If you need to collect coverage data from different machines or processes, |
167 coverage can combine multiple files into one for reporting. Use the ``-p`` flag | 185 coverage can combine multiple files into one for reporting. Use the ``-p`` flag |
168 during execution to append distinguishing information to the .coverage data | 186 during execution to append distinguishing information to the .coverage data |
169 file name. | 187 file name. |
170 | 188 |
171 Once you have created a number of these files, you can copy them all to a single | 189 Once you have created a number of these files, you can copy them all to a |
172 directory, and use the **combine** command to combine them into one .coverage | 190 single directory, and use the **combine** command to combine them into one |
173 data file:: | 191 .coverage data file:: |
174 | 192 |
175 $ coverage combine | 193 $ coverage combine |
176 | 194 |
177 If the different machines run your code from different places in their file | 195 If the different machines run your code from different places in their file |
178 systems, coverage won't know how to combine the data. You can tell coverage | 196 systems, coverage won't know how to combine the data. You can tell coverage |
179 how the different locations correlate with a ``[paths]`` section in your | 197 how the different locations correlate with a ``[paths]`` section in your |
180 configuration file. See :ref:`config_paths` for details. | 198 configuration file. See :ref:`config_paths` for details. |
181 | 199 |
182 If you are collecting and renaming your own data files, you'll need to name | 200 If you are collecting and renaming your own data files, you'll need to name |
183 them properly for **combine** to find them. It looks for files named after | 201 them properly for **combine** to find them. It looks for files named after |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 is a data file that is used to speed up reporting the next time. If you | 319 is a data file that is used to speed up reporting the next time. If you |
302 generate a new report into the same directory, coverage.py will skip | 320 generate a new report into the same directory, coverage.py will skip |
303 generating unchanged pages, making the process faster. | 321 generating unchanged pages, making the process faster. |
304 | 322 |
305 | 323 |
306 .. _cmd_annotation: | 324 .. _cmd_annotation: |
307 | 325 |
308 Text annotation | 326 Text annotation |
309 --------------- | 327 --------------- |
310 | 328 |
311 The **annotate** command produces a text annotation of your source code. With a | 329 The **annotate** command produces a text annotation of your source code. With |
312 ``-d`` argument specifying an output directory, each Python file becomes a text | 330 a ``-d`` argument specifying an output directory, each Python file becomes a |
313 file in that directory. Without ``-d``, the files are written into the same | 331 text file in that directory. Without ``-d``, the files are written into the |
314 directories as the original Python files. | 332 same directories as the original Python files. |
315 | 333 |
316 Coverage status for each line of source is indicated with a character prefix:: | 334 Coverage status for each line of source is indicated with a character prefix:: |
317 | 335 |
318 > executed | 336 > executed |
319 ! missing (not executed) | 337 ! missing (not executed) |
320 - excluded | 338 - excluded |
321 | 339 |
322 For example:: | 340 For example:: |
323 | 341 |
324 # A simple function, never called with x==1 | 342 # A simple function, never called with x==1 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 ----------- | 374 ----------- |
357 | 375 |
358 The **debug** command shows internal information to help diagnose problems. | 376 The **debug** command shows internal information to help diagnose problems. |
359 If you are reporting a bug about coverage.py, including the output of this | 377 If you are reporting a bug about coverage.py, including the output of this |
360 command can often help:: | 378 command can often help:: |
361 | 379 |
362 $ coverage debug sys > please_attach_to_bug_report.txt | 380 $ coverage debug sys > please_attach_to_bug_report.txt |
363 | 381 |
364 Two types of information are available: ``sys`` to show system configuration, | 382 Two types of information are available: ``sys`` to show system configuration, |
365 and ``data`` to show a summary of the collected coverage data. | 383 and ``data`` to show a summary of the collected coverage data. |
OLD | NEW |