diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-05 11:07:11 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-05 11:07:11 -0400 |
commit | a9afb77456c4e658c25cb5f76abe611d1777cd8e (patch) | |
tree | 194c460e27b7ad7557811692c7ff5dcb26aabc99 /tests/plugin2.py | |
parent | 2f829835fc65bea053c884a6b97922c07edcf1ac (diff) | |
download | python-coveragepy-git-a9afb77456c4e658c25cb5f76abe611d1777cd8e.tar.gz |
Change how plugins are initialized. No more Plugin. Now coverage_init.
Diffstat (limited to 'tests/plugin2.py')
-rw-r--r-- | tests/plugin2.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py index 70d25249..9c3cb1d4 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)) |