summaryrefslogtreecommitdiff
path: root/tests/plugin_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugin_config.py')
-rw-r--r--tests/plugin_config.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/plugin_config.py b/tests/plugin_config.py
new file mode 100644
index 00000000..67a790a2
--- /dev/null
+++ b/tests/plugin_config.py
@@ -0,0 +1,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())