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
commit02cecb43c2cf5693eace5c60204e0831a0ec49b7 (patch)
tree58e2a424f001ac0c6b2e68959bb0bf84f675fa91 /tests/plugin2.py
parent7170c660826939a0f31137300bc29c5843095e47 (diff)
downloadpython-coveragepy-02cecb43c2cf5693eace5c60204e0831a0ec49b7.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 4fb3d05..7d2ac7c 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))