summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/control.py9
-rw-r--r--coverage/data.py4
-rw-r--r--tests/plugin2.py3
3 files changed, 12 insertions, 4 deletions
diff --git a/coverage/control.py b/coverage/control.py
index defba56c..574c8748 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -754,10 +754,13 @@ class Coverage(object):
if not self._measured:
return
+ def abs_file_dict(d):
+ return dict((abs_file(k), v) for k,v in iitems(d))
+
# TODO: seems like this parallel structure is getting kinda old...
- self.data.add_line_data(self.collector.get_line_data())
- self.data.add_arc_data(self.collector.get_arc_data())
- self.data.add_plugin_data(self.collector.get_plugin_data())
+ self.data.add_line_data(abs_file_dict(self.collector.get_line_data()))
+ self.data.add_arc_data(abs_file_dict(self.collector.get_arc_data()))
+ self.data.add_plugin_data(abs_file_dict(self.collector.get_plugin_data()))
self.collector.reset()
# If there are still entries in the source_pkgs list, then we never
diff --git a/coverage/data.py b/coverage/data.py
index 8a699b5b..22b711d1 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -244,6 +244,10 @@ class CoverageData(object):
self.arcs.setdefault(filename, {}).update(arcs)
def add_plugin_data(self, plugin_data):
+ """Add per-file plugin information.
+
+ `plugin_data` is { filename: plugin_name, ... }
+ """
self.plugins.update(plugin_data)
def touch_file(self, filename):
diff --git a/tests/plugin2.py b/tests/plugin2.py
index 658ee221..70d25249 100644
--- a/tests/plugin2.py
+++ b/tests/plugin2.py
@@ -25,7 +25,8 @@ class RenderFileTracer(coverage.plugin.FileTracer):
def dynamic_source_filename(self, filename, frame):
if frame.f_code.co_name != "render":
return None
- return os.path.abspath(frame.f_locals['filename'])
+ source_filename = os.path.abspath(frame.f_locals['filename'])
+ return source_filename
def line_number_range(self, frame):
lineno = frame.f_locals['linenum']