OLD | NEW |
(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 .. _plugins: |
| 5 |
| 6 ======= |
| 7 Plugins |
| 8 ======= |
| 9 |
| 10 .. :history: 20150124T143000, new page. |
| 11 .. :history: 20150802T174600, updated for 4.0b1 |
| 12 |
| 13 |
| 14 Coverage.py's behavior can be extended with third-party plugins. A plugin is a |
| 15 separately installed Python class that you register in your .coveragerc. |
| 16 Plugins can be used to implement coverage measurement for non-Python files. |
| 17 |
| 18 Information about using plugins is on this page. To write a plugin, see |
| 19 :ref:`api_plugin`. |
| 20 |
| 21 .. versionadded:: 4.0 |
| 22 |
| 23 |
| 24 Using plugins |
| 25 ------------- |
| 26 |
| 27 To use a coverage.py plugin, you install it, and configure it. For this |
| 28 example, let's say there's a Python package called ``something`` that provides a |
| 29 coverage.py plugin called ``something.plugin``. |
| 30 |
| 31 #. Install the plugin's package as you would any other Python package:: |
| 32 |
| 33 pip install something |
| 34 |
| 35 #. Configure coverage.py to use the plugin. You do this by editing (or |
| 36 creating) your .coveragerc file, as described in :ref:`config`. The |
| 37 ``plugins`` setting indicates your plugin. It's a list of importable module |
| 38 names of plugins:: |
| 39 |
| 40 [run] |
| 41 plugins = |
| 42 something.plugin |
| 43 |
| 44 #. If the plugin needs its own configuration, you can add those settings in |
| 45 the .coveragerc file in a section named for the plugin:: |
| 46 |
| 47 [something.plugin] |
| 48 option1 = True |
| 49 option2 = abc.foo |
| 50 |
| 51 Check the documentation for the plugin to see if it takes any options, and |
| 52 what they are. |
| 53 |
| 54 #. Run your tests with coverage.py as you usually would. |
| 55 |
| 56 |
| 57 Available plugins |
| 58 ----------------- |
| 59 |
| 60 Some coverage.py plugins you might find useful: |
| 61 |
| 62 * `Django template coverage.py plugin`__: for measuring coverage in Django |
| 63 templates. |
| 64 |
| 65 .. __: https://pypi.python.org/pypi/django_coverage_plugin |
| 66 |
| 67 * `Mako template coverage plugin`__: for measuring coverage in Mako templates. |
| 68 Doesn't work yet, probably needs some changes in Mako itself. |
| 69 |
| 70 .. __: https://bitbucket.org/ned/coverage-mako-plugin |
OLD | NEW |