summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/data.py3
-rw-r--r--tests/test_data.py4
2 files changed, 6 insertions, 1 deletions
diff --git a/coverage/data.py b/coverage/data.py
index 68b02127..3eb51bf3 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -301,7 +301,8 @@ class CoverageData(object):
else:
file_data['lines'] = self._lines
- file_data['plugins'] = self._plugins
+ if self._plugins:
+ file_data['plugins'] = self._plugins
# Write the data to the file.
json.dump(file_data, file_obj)
diff --git a/tests/test_data.py b/tests/test_data.py
index ea33a587..ef058e51 100644
--- a/tests/test_data.py
+++ b/tests/test_data.py
@@ -498,6 +498,8 @@ class CoverageDataFilesTest(DataTestHelpers, CoverageTest):
self.assertCountEqual(lines['b.py'], B_PY_LINES_1)
# If not measuring branches, there's no arcs entry.
self.assertNotIn('arcs', data)
+ # If no plugins were involved, there's no plugins entry.
+ self.assertNotIn('plugins', data)
def test_file_format_with_arcs(self):
# Write with CoverageData, then read the JSON explicitly.
@@ -513,6 +515,8 @@ class CoverageDataFilesTest(DataTestHelpers, CoverageTest):
self.assertCountEqual(arcs.keys(), MEASURED_FILES_3)
self.assertCountEqual(arcs['x.py'], map(list, X_PY_ARCS_3))
self.assertCountEqual(arcs['y.py'], map(list, Y_PY_ARCS_3))
+ # If no plugins were involved, there's no plugins entry.
+ self.assertNotIn('plugins', data)
def test_writing_to_other_file(self):
data_files = CoverageDataFiles(".otherfile")