summaryrefslogtreecommitdiff
path: root/coverage/control.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-08-07 11:53:27 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-08-07 11:53:27 -0400
commitb3d626c3936d11c189b8e810ccb93ceaa019b156 (patch)
treed25f408e9400368eb36baaab82139a4c47594b22 /coverage/control.py
parent0e8b701b7ff23608d759188876ac3c9bf8669a47 (diff)
downloadpython-coveragepy-git-b3d626c3936d11c189b8e810ccb93ceaa019b156.tar.gz
Combining twice shouldn't lose data. #412, #516
Diffstat (limited to 'coverage/control.py')
-rw-r--r--coverage/control.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py
index cc661967..32fb30c0 100644
--- a/coverage/control.py
+++ b/coverage/control.py
@@ -791,7 +791,7 @@ class Coverage(object):
self.get_data()
self.data_files.write(self.data, suffix=self.data_suffix)
- def combine(self, data_paths=None):
+ def combine(self, data_paths=None, strict=False):
"""Combine together a number of similarly-named coverage data files.
All coverage data files whose name starts with `data_file` (from the
@@ -803,9 +803,15 @@ class Coverage(object):
directory indicated by the current data file (probably the current
directory) will be combined.
+ If `strict` is true, then it is an error to attempt to combine when
+ there are no data files to combine.
+
.. versionadded:: 4.0
The `data_paths` parameter.
+ .. versionadded:: 4.3
+ The `strict` parameter.
+
"""
self._init()
self.get_data()
@@ -818,7 +824,9 @@ class Coverage(object):
for pattern in paths[1:]:
aliases.add(pattern, result)
- self.data_files.combine_parallel_data(self.data, aliases=aliases, data_paths=data_paths)
+ self.data_files.combine_parallel_data(
+ self.data, aliases=aliases, data_paths=data_paths, strict=strict,
+ )
def get_data(self):
"""Get the collected data and reset the collector.