From 1035b301586737bd44d6a8a9739e3cce53406622 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 7 Aug 2016 11:53:27 -0400 Subject: Combining twice shouldn't lose data. #412, #516 --- coverage/control.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'coverage/control.py') 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. -- cgit v1.2.1