diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2014-11-24 20:31:27 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-11-24 20:31:27 -0500 |
| commit | d182230b96de38b3cd318cf74a84787e1fc9b90d (patch) | |
| tree | b9cf8751d285e02aee2b2f127239b4aebf6f93ac /tests | |
| parent | fb9b49123c5a528bec55f2865b1730414d513559 (diff) | |
| download | python-coveragepy-d182230b96de38b3cd318cf74a84787e1fc9b90d.tar.gz | |
Forgot this file
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/plugin2.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/plugin2.py b/tests/plugin2.py new file mode 100644 index 0000000..1fa66cb --- /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 |
