diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-20 08:40:23 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-20 08:40:23 -0400 |
commit | 71e2ee0a55ec660e8e3ba33c12ccad2f8aac3bd3 (patch) | |
tree | e161c13de45bb8dc5f3c0821b3aff9204ff5f6cb /coverage/data.py | |
parent | 3dbc97c1880b1199169e7f975795d12d5d3cf7b8 (diff) | |
download | python-coveragepy-71e2ee0a55ec660e8e3ba33c12ccad2f8aac3bd3.tar.gz |
Be more strict when recording plugin names
Diffstat (limited to 'coverage/data.py')
-rw-r--r-- | coverage/data.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/coverage/data.py b/coverage/data.py index e5c37cb..b1fcd21 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -216,7 +216,20 @@ class CoverageData(object): `plugin_data` is { filename: plugin_name, ... } """ - self._plugins.update(plugin_data) + existing_files = self._arcs or self._lines + for filename, plugin_name in iitems(plugin_data): + if filename not in existing_files: + raise CoverageException( + "Can't add plugin data for unmeasured file '%s'" % (filename,) + ) + existing_plugin = self._plugins.get(filename) + if existing_plugin is not None and plugin_name != existing_plugin: + raise CoverageException( + "Conflicting plugin name for '%s': %r vs %r" % ( + filename, existing_plugin, plugin_name, + ) + ) + self._plugins[filename] = plugin_name def update(self, other_data, aliases=None): """Update this data with data from another `CoverageData`. |