summaryrefslogtreecommitdiff
path: root/tests/plugin2.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-01-02 13:41:13 -0500
committerNed Batchelder <ned@nedbatchelder.com>2015-01-02 13:41:13 -0500
commitc6bef38e75d8131075da6930576dd3b9c594e9ff (patch)
tree2ba7fe7afe461eda2beb6b3a6fae74bf68d66823 /tests/plugin2.py
parent08dfd5555a023cf8d2638e1f8e6cd948690523a5 (diff)
downloadpython-coveragepy-git-c6bef38e75d8131075da6930576dd3b9c594e9ff.tar.gz
Start formalizing the FileReporter interface to simplify things
Diffstat (limited to 'tests/plugin2.py')
-rw-r--r--tests/plugin2.py13
1 files changed, 2 insertions, 11 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py
index 4fb3d057..7d2ac7cb 100644
--- a/tests/plugin2.py
+++ b/tests/plugin2.py
@@ -1,7 +1,6 @@
"""A plugin for test_plugins.py to import."""
import coverage
-from coverage.parser import CodeParser
class Plugin(coverage.CoveragePlugin):
@@ -30,19 +29,11 @@ class RenderFileTracer(coverage.plugin.FileTracer):
class FileReporter(coverage.plugin.FileReporter):
- # TODO: Why do I have to make a FileReporter just to make a CodeParser??
def __init__(self, filename):
self.filename = filename
- def get_parser(self, exclude=None):
+ def statements(self):
# Goofy test arrangement: claim that the file has as many lines as the
# number in its name.
num = self.filename.split(".")[0].split("_")[1]
- return PluginParser(int(num))
-
-class PluginParser(CodeParser):
- def __init__(self, num_lines):
- self.num_lines = num_lines
-
- def parse_source(self):
- return set(range(1, self.num_lines+1)), set([])
+ return set(range(1, int(num)+1))