summaryrefslogtreecommitdiff
path: root/coverage/data.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-07-28 06:46:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-07-28 06:46:25 -0400
commit130b1a2f0b221d584d65edf035906fb0e8c45996 (patch)
tree8e2c2913d725802f022b133b1b668a9157e74d04 /coverage/data.py
parentef8c162b454a0f294e348b27bd52475f0e512e59 (diff)
downloadpython-coveragepy-130b1a2f0b221d584d65edf035906fb0e8c45996.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.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/coverage/data.py b/coverage/data.py
index 7e14a69..de68dba 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))