summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/control.py12
-rw-r--r--tests/test_summary.py26
2 files changed, 21 insertions, 17 deletions
diff --git a/coverage/control.py b/coverage/control.py
index b499d456..ffed8e68 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -442,6 +442,7 @@ class Coverage(object):
disp.canonical_filename = canonical
# Try the plugins, see if they have an opinion about the file.
+ plugin = None
for plugin in self.file_tracers:
file_tracer = plugin.file_tracer(canonical)
if file_tracer is not None:
@@ -451,13 +452,15 @@ class Coverage(object):
if file_tracer.has_dynamic_source_filename():
disp.has_dynamic_filename = True
else:
- disp.source_filename = self.file_locator.canonical_filename(file_tracer.source_filename())
+ disp.source_filename = \
+ self.file_locator.canonical_filename(
+ file_tracer.source_filename()
+ )
break
else:
# No plugin wanted it: it's Python.
disp.trace = True
disp.source_filename = canonical
- file_tracer = None
if not disp.has_dynamic_filename:
if not disp.source_filename:
@@ -1124,5 +1127,6 @@ class Plugins(object):
def __iter__(self):
return iter(self.order)
- def get(self, module):
- return self.names[module]
+ def get(self, plugin_name):
+ """Return a plugin by name."""
+ return self.names[plugin_name]
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 6fc4fc8d..64482167 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -37,13 +37,13 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'done\n')
report = self.report_from_command("coverage report")
- # Name Stmts Miss Cover
- # ------------------------------------------------------------------------
- # c:/ned/coverage/trunk/tests/modules/covmod1.py 2 0 100%
- # c:/ned/coverage/trunk/tests/zipmods.zip/covmodzip1.py 2 0 100%
- # mycode.py 4 0 100%
- # ------------------------------------------------------------------------
- # TOTAL 8 0 100%
+ # Name Stmts Miss Cover
+ # ------------------------------------------------------------------
+ # c:/ned/coverage/tests/modules/covmod1.py 2 0 100%
+ # c:/ned/coverage/tests/zipmods.zip/covmodzip1.py 2 0 100%
+ # mycode.py 4 0 100%
+ # ------------------------------------------------------------------
+ # TOTAL 8 0 100%
self.assertNotIn("/coverage/__init__/", report)
self.assertIn("/tests/modules/covmod1.py ", report)
@@ -211,12 +211,12 @@ class SummaryTest(CoverageTest):
self.assertEqual(out, 'x\ny\n')
report = self.report_from_command("coverage report --show-missing")
- # Name Stmts Miss Branch BrPart Cover Missing
- # ----------------------------------------------------------
- # main.py 1 0 0 0 100%
- # mybranch.py 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7
- # ----------------------------------------------------------
- # TOTAL 11 2 8 3 63%
+ # Name Stmts Miss Branch BrPart Cover Missing
+ # -------------------------------------------------------
+ # main.py 1 0 0 0 100%
+ # mybranch.py 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7
+ # -------------------------------------------------------
+ # TOTAL 11 2 8 3 63%
self.assertEqual(self.line_count(report), 6)
squeezed = self.squeezed_lines(report)