summaryrefslogtreecommitdiff
path: root/tests/test_plugins.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2020-09-13 13:30:20 -0400
committerNed Batchelder <ned@nedbatchelder.com>2020-09-13 13:33:04 -0400
commit987ceb9300c9326e4932dd69d633e7bd7be04e16 (patch)
treee7d2b4536b3e29b6cb10019468894a06a9d86c62 /tests/test_plugins.py
parentc907b2ee1184dbcea1a3698588ad198a32fbea71 (diff)
downloadpython-coveragepy-git-987ceb9300c9326e4932dd69d633e7bd7be04e16.tar.gz
Fix a missed exception handling for bad plugins
Diffstat (limited to 'tests/test_plugins.py')
-rw-r--r--tests/test_plugins.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_plugins.py b/tests/test_plugins.py
index 2477f5ce..ed58c5f4 100644
--- a/tests/test_plugins.py
+++ b/tests/test_plugins.py
@@ -804,6 +804,28 @@ class BadFileTracerTest(FileTracerTest):
""")
self.run_bad_plugin("bad_plugin", "Plugin")
+ def test_line_number_range_raises_error(self):
+ self.make_file("bad_plugin.py", """\
+ import coverage.plugin
+ class Plugin(coverage.plugin.CoveragePlugin):
+ def file_tracer(self, filename):
+ if filename.endswith("other.py"):
+ return BadFileTracer()
+
+ class BadFileTracer(coverage.plugin.FileTracer):
+ def source_filename(self):
+ return "something.foo"
+
+ def line_number_range(self, frame):
+ raise Exception("borked!")
+
+ def coverage_init(reg, options):
+ reg.add_file_tracer(Plugin())
+ """)
+ self.run_bad_plugin(
+ "bad_plugin", "Plugin", our_error=False, excmsg="borked!",
+ )
+
def test_line_number_range_returns_non_tuple(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin