summaryrefslogtreecommitdiff
path: root/tests/plugin_config.py
blob: 67a790a2ef920d217947fa87fe3632e3824bf343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt

"""A configuring plugin for test_plugins.py to import."""

import coverage


class Plugin(coverage.CoveragePlugin):
    """A configuring plugin for testing."""
    def configure(self, config):
        """Configure all the things!"""
        opt_name = "report:exclude_lines"
        exclude_lines = config.get_option(opt_name)
        exclude_lines.append(r"pragma: custom")
        exclude_lines.append(r"pragma: or whatever")
        config.set_option(opt_name, exclude_lines)


def coverage_init(reg, options):        # pylint: disable=unused-argument
    """Called by coverage to initialize the plugins here."""
    reg.add_configurer(Plugin())