summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/plugin1.py11
-rw-r--r--tests/plugin2.py13
2 files changed, 6 insertions, 18 deletions
diff --git a/tests/plugin1.py b/tests/plugin1.py
index c7660024..f9da35c8 100644
--- a/tests/plugin1.py
+++ b/tests/plugin1.py
@@ -3,7 +3,6 @@
import os.path
import coverage
-from coverage.parser import CodeParser
class Plugin(coverage.CoveragePlugin):
@@ -40,10 +39,8 @@ class FileTracer(coverage.plugin.FileTracer):
class FileReporter(coverage.plugin.FileReporter):
"""Dead-simple FileReporter."""
- def get_parser(self, exclude=None):
- return PluginParser()
+ def statements(self):
+ return set([105, 106, 107, 205, 206, 207])
-class PluginParser(CodeParser):
- """CodeParser hard-coded for a test in test_plugins.py."""
- def parse_source(self):
- return set([105, 106, 107, 205, 206, 207]), set([])
+ def excluded_statements(self):
+ return set([])
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))