summaryrefslogtreecommitdiff
path: root/tests/plugin2.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-07-05 11:07:11 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-07-05 11:07:11 -0400
commit152d22cfbae8a8371acabe35ae3de61fb31708d3 (patch)
tree56527f16582dc7e3ae53f0591676443f7e93d583 /tests/plugin2.py
parent08fa87e78191c2126bb441b95730e857da32b4c9 (diff)
downloadpython-coveragepy-152d22cfbae8a8371acabe35ae3de61fb31708d3.tar.gz
Change how plugins are initialized. No more Plugin. Now coverage_init.
Diffstat (limited to 'tests/plugin2.py')
-rw-r--r--tests/plugin2.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py
index 70d2524..9c3cb1d 100644
--- a/tests/plugin2.py
+++ b/tests/plugin2.py
@@ -4,10 +4,9 @@ import os.path
import coverage
-# pylint: disable=missing-docstring
-
class Plugin(coverage.CoveragePlugin):
+ """A plugin for testing."""
def file_tracer(self, filename):
if "render.py" in filename:
return RenderFileTracer()
@@ -34,8 +33,14 @@ class RenderFileTracer(coverage.plugin.FileTracer):
class FileReporter(coverage.plugin.FileReporter):
+ """A goofy file reporter."""
def statements(self):
# Goofy test arrangement: claim that the file has as many lines as the
# number in its name.
num = os.path.basename(self.filename).split(".")[0].split("_")[1]
return set(range(1, int(num)+1))
+
+
+def coverage_init(reg, options):
+ """Called by coverage to initialize the plugins here."""
+ reg.add_file_tracer(Plugin(options))