| OLD | NEW |
| 1 .. _source: | 1 .. _source: |
| 2 | 2 |
| 3 ======================= | 3 ======================= |
| 4 Specifying source files | 4 Specifying source files |
| 5 ======================= | 5 ======================= |
| 6 | 6 |
| 7 :history: 20100725T172000, new in 3.4 | 7 :history: 20100725T172000, new in 3.4 |
| 8 | 8 |
| 9 | 9 |
| 10 When coverage.py is running your program and measuring its execution, it needs | 10 When coverage.py is running your program and measuring its execution, it needs |
| 11 to know what code to measure and what code not to. Measurement imposes a speed | 11 to know what code to measure and what code not to. Measurement imposes a speed |
| 12 penalty, and the collected data must be stored in memory and then on disk. | 12 penalty, and the collected data must be stored in memory and then on disk. |
| 13 More importantly, when reviewing your coverage reports, you don't want to be | 13 More importantly, when reviewing your coverage reports, you don't want to be |
| 14 distracted with modules that aren't your concern. | 14 distracted with modules that aren't your concern. |
| 15 | 15 |
| 16 Coverage.py has a number of ways you can focus it in on the code you care | 16 Coverage.py has a number of ways you can focus it in on the code you care |
| 17 about. | 17 about. |
| 18 | 18 |
| 19 | 19 |
| 20 .. _source_execution: | 20 .. _source_execution: |
| 21 | 21 |
| 22 Execution | 22 Execution |
| 23 --------- | 23 --------- |
| 24 | 24 |
| 25 When running your code, the ``coverage run`` command will by default measure | 25 When running your code, the ``coverage run`` command will by default measure |
| 26 all code, unless it is part of the Python standard library. | 26 all code, unless it is part of the Python standard library. |
| 27 | 27 |
| 28 You can specify source to measure with the ``--source`` command-line switch, | 28 You can specify source to measure with the ``--source`` command-line switch, or |
| 29 or the ``[run] source`` configuration value. The value is a list of directories | 29 the ``[run] source`` configuration value. The value is a list of directories |
| 30 or package names. If specified, only source inside these directories or | 30 or package names. If specified, only source inside these directories or |
| 31 packages will be measured. Specifying the source option also enables | 31 packages will be measured. Specifying the source option also enables |
| 32 coverage.py to report on unexecuted files, since it can search the source tree | 32 coverage.py to report on unexecuted files, since it can search the source tree |
| 33 for files that haven't been measured at all. | 33 for files that haven't been measured at all. |
| 34 | 34 |
| 35 You can further fine-tune coverage.py's attention with the ``--include`` and | 35 You can further fine-tune coverage.py's attention with the ``--include`` and |
| 36 ``--omit`` switches (or ``[run] include`` and ``[run] omit`` configuration | 36 ``--omit`` switches (or ``[run] include`` and ``[run] omit`` configuration |
| 37 values). ``--include`` is a list of filename patterns. If specified, only files | 37 values). ``--include`` is a list of filename patterns. If specified, only files |
| 38 matching those patterns will be measured. ``--omit`` is also a list of filename | 38 matching those patterns will be measured. ``--omit`` is also a list of filename |
| 39 patterns, specifying files not to measure. If both ``include`` and ``omit`` | 39 patterns, specifying files not to measure. If both ``include`` and ``omit`` |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 ``modules`` arguments specify particular modules to report on. The ``include`` | 65 ``modules`` arguments specify particular modules to report on. The ``include`` |
| 66 and ``omit`` values are lists of filename patterns, just as with the ``run`` | 66 and ``omit`` values are lists of filename patterns, just as with the ``run`` |
| 67 command. | 67 command. |
| 68 | 68 |
| 69 Remember that the reporting commands can only report on the data that has been | 69 Remember that the reporting commands can only report on the data that has been |
| 70 collected, so the data you're looking for may not be in the data available for | 70 collected, so the data you're looking for may not be in the data available for |
| 71 reporting. | 71 reporting. |
| 72 | 72 |
| 73 Note that these are ways of specifying files to measure. You can also exclude | 73 Note that these are ways of specifying files to measure. You can also exclude |
| 74 individual source lines. See :ref:`excluding` for details. | 74 individual source lines. See :ref:`excluding` for details. |
| OLD | NEW |