diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-04 11:08:36 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-10-04 11:08:36 -0400 |
commit | 5205da079a8e099f9f5c6895b2cd634fc512fc55 (patch) | |
tree | 75af617e7645f2ba8070f41659b919279bf3daf9 /coverage | |
parent | 6bf4946e0bc8599a1258c5107f7eece2efa70925 (diff) | |
download | python-coveragepy-git-5205da079a8e099f9f5c6895b2cd634fc512fc55.tar.gz |
Combining now issues warnings on unreadable files, unconditionally
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/cmdline.py | 10 | ||||
-rw-r--r-- | coverage/config.py | 6 | ||||
-rw-r--r-- | coverage/control.py | 11 | ||||
-rw-r--r-- | coverage/data.py | 11 |
4 files changed, 8 insertions, 30 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 6f5719fd..46a87ca6 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -58,10 +58,6 @@ class Opts(object): '-i', '--ignore-errors', action='store_true', help="Ignore errors while reading source files.", ) - ignore_combine_errors = optparse.make_option( - '-i', '--ignore-errors', action='store_true', - help="Ignore errors while reading data files.", - ) include = optparse.make_option( '', '--include', action='store', metavar="PAT1,PAT2,...", @@ -270,9 +266,7 @@ CMDS = { 'combine': CmdOptionParser( "combine", - [ - Opts.ignore_combine_errors, - ] + GLOBAL_ARGS, + GLOBAL_ARGS, usage="<path1> <path2> ... <pathN>", description=( "Combine data from multiple coverage files collected " @@ -471,7 +465,7 @@ class CoverageScript(object): elif options.action == "combine": self.coverage.load() data_dirs = args or None - self.coverage.combine(data_dirs, ignore_errors=options.ignore_errors) + self.coverage.combine(data_dirs) self.coverage.save() return OK diff --git a/coverage/config.py b/coverage/config.py index 8aff41dc..458d4903 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -162,9 +162,6 @@ class CoverageConfig(object): self.source = None self.timid = False - # Defaults for [combine] - self.ignore_combine_errors = False - # Defaults for [report] self.exclude_list = DEFAULT_EXCLUDE[:] self.fail_under = 0 @@ -280,9 +277,6 @@ class CoverageConfig(object): ('source', 'run:source', 'list'), ('timid', 'run:timid', 'boolean'), - # [combine] - ('ignore_combine_errors', 'combine:ignore_errors', 'boolean'), - # [report] ('exclude_list', 'report:exclude_lines', 'regexlist'), ('fail_under', 'report:fail_under', 'int'), diff --git a/coverage/control.py b/coverage/control.py index a5741a47..1fb0f5bf 100644 --- a/coverage/control.py +++ b/coverage/control.py @@ -763,7 +763,7 @@ class Coverage(object): self.get_data() self.data_files.write(self.data, suffix=self.data_suffix) - def combine(self, data_paths=None, ignore_errors=None): + def combine(self, data_paths=None): """Combine together a number of similarly-named coverage data files. All coverage data files whose name starts with `data_file` (from the @@ -782,8 +782,6 @@ class Coverage(object): self._init() self.get_data() - self.config.from_args(ignore_combine_errors=ignore_errors) - aliases = None if self.config.paths: aliases = PathAliases() @@ -792,12 +790,7 @@ 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, - ignore_errors=self.config.ignore_combine_errors, - ) + self.data_files.combine_parallel_data(self.data, aliases=aliases, data_paths=data_paths) def get_data(self): """Get the collected data and reset the collector. diff --git a/coverage/data.py b/coverage/data.py index b8d9dadf..fb0b0224 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -662,7 +662,7 @@ class CoverageDataFiles(object): filename += "." + suffix data.write_file(filename) - def combine_parallel_data(self, data, aliases=None, data_paths=None, ignore_errors=False): + def combine_parallel_data(self, data, aliases=None, data_paths=None): """Combine a number of data files together. Treat `self.filename` as a file prefix, and combine the data from all @@ -678,10 +678,9 @@ class CoverageDataFiles(object): If `data_paths` is not provided, then the directory portion of `self.filename` is used as the directory to search for data files. - Every data file found and combined is then deleted from disk. - - If `ignore_errors` is True, then files that cannot be read will cause - a warning, and will not be deleted. + Every data file found and combined is then deleted from disk. If a file + cannot be read, a warning will be issued, and the file will not be + deleted. """ # Because of the os.path.abspath in the constructor, data_dir will @@ -705,8 +704,6 @@ class CoverageDataFiles(object): try: new_data.read_file(f) except CoverageException as exc: - if not ignore_errors: - raise if self.warn: # The CoverageException has the file name in it, so just # use the message as the warning. |