summaryrefslogtreecommitdiff
path: root/tests/plugin2.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-11-24 20:31:27 -0500
committerNed Batchelder <ned@nedbatchelder.com>2014-11-24 20:31:27 -0500
commit8fa9db9f86de0b7cbce45e0a5fe87e38e47212b7 (patch)
tree39d317bb643acf1569230a0274a711e6e130278e /tests/plugin2.py
parentb0a0f00a433d7c3467d07ce7cea4cfbaaa6ae49e (diff)
downloadpython-coveragepy-git-8fa9db9f86de0b7cbce45e0a5fe87e38e47212b7.tar.gz
Forgot this file
Diffstat (limited to 'tests/plugin2.py')
-rw-r--r--tests/plugin2.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py
new file mode 100644
index 00000000..1fa66cb2
--- /dev/null
+++ b/tests/plugin2.py
@@ -0,0 +1,24 @@
+"""A plugin for test_plugins.py to import."""
+
+import coverage
+
+class Plugin(coverage.CoveragePlugin):
+ def file_tracer(self, filename):
+ if "render.py" in filename:
+ return RenderFileTracer(filename)
+
+
+class RenderFileTracer(coverage.plugin.FileTracer):
+ def __init__(self, filename):
+ pass
+
+ def has_dynamic_source_filename(self):
+ return True
+
+ def dynamic_source_filename(self, filename, frame):
+ filename = "fake%d.html" % frame.f_lineno
+ print("dynamic filename: %r" % filename)
+ return filename
+
+ def line_number_range(self, frame):
+ return 17,19