diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2016-08-07 11:53:27 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2016-08-07 11:53:27 -0400 |
commit | 1035b301586737bd44d6a8a9739e3cce53406622 (patch) | |
tree | 1427819040c2210ae8e14c694e23d2802dcded00 /coverage/control.py | |
parent | 515479de68afb93dd0829a30ff191dff707e0892 (diff) | |
download | python-coveragepy-1035b301586737bd44d6a8a9739e3cce53406622.tar.gz |
Combining twice shouldn't lose data. #412, #516
Diffstat (limited to 'coverage/control.py')
-rw-r--r-- | coverage/control.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/coverage/control.py b/coverage/control.py index cc66196..32fb30c 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. |