diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-28 06:46:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2015-07-28 06:46:25 -0400 |
commit | 89eed280180965a23fc338449cb3c8a6655d93e8 (patch) | |
tree | b4cad32be1ba775ec57b18d7faab8854364f75ba /coverage/data.py | |
parent | 5ffa5e5f76ca2ddddb4a31e38a1cc5b800e206d6 (diff) | |
download | python-coveragepy-git-89eed280180965a23fc338449cb3c8a6655d93e8.tar.gz |
When directories are provided to combine data files, fail if one doesn't exist.
Diffstat (limited to 'coverage/data.py')
-rw-r--r-- | coverage/data.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/data.py b/coverage/data.py index 7e14a695..de68dba1 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -601,15 +601,23 @@ class CoverageDataFiles(object): re-map paths to match the local machine's. If `data_dirs` is provided, then it combines the data files from each - directory into a single file. + directory into a single file. If `data_dirs` 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. """ + # Because of the os.path.abspath in the constructor, data_dir will + # never be an empty string. data_dir, local = os.path.split(self.filename) localdot = local + '.*' data_dirs = data_dirs or [data_dir] files_to_combine = [] for d in data_dirs: + if not os.path.isdir(d): + raise CoverageException("Couldn't combine from non-existent directory '%s'" % (d,)) pattern = os.path.join(os.path.abspath(d), localdot) files_to_combine.extend(glob.glob(pattern)) |