diff options
Diffstat (limited to 'coverage')
-rw-r--r-- | coverage/cmdline.py | 8 | ||||
-rw-r--r-- | coverage/data.py | 17 |
2 files changed, 17 insertions, 8 deletions
diff --git a/coverage/cmdline.py b/coverage/cmdline.py index 669c569e..499444ca 100644 --- a/coverage/cmdline.py +++ b/coverage/cmdline.py @@ -252,13 +252,13 @@ CMDS = { ), 'combine': CmdOptionParser("combine", GLOBAL_ARGS, - usage = "<dir1> <dir2> ... <dirN>", + usage = "<path1> <path2> ... <pathN>", description = "Combine data from multiple coverage files collected " "with 'run -p'. The combined results are written to a single " "file representing the union of the data. The positional " - "arguments are directories from which the data files should be " - "combined. By default, only data files in the current directory " - "are combined." + "arguments are files or directories or shell globs " + "representing the data files which should be combined. " + "By default, only data files in the current directory are combined." ), 'debug': CmdOptionParser("debug", GLOBAL_ARGS, diff --git a/coverage/data.py b/coverage/data.py index de68dba1..4e7d999e 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -616,12 +616,21 @@ class CoverageDataFiles(object): 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)) + if os.path.isfile(d): + files_to_combine.append(os.path.abspath(d)) + elif os.path.isdir(d): + pattern = os.path.join(os.path.abspath(d), localdot) + files_to_combine.extend(glob.glob(pattern)) + else: + files = glob.glob(d) + if not files: + raise CoverageException("Couldn't combine from non-existing path '%s'" % (d,)) + files_to_combine.extend(files) + for f in files_to_combine: + if not os.path.isfile(f): + raise CoverageException("Couldn't combine from non-existing file '%s'" % (f,)) new_data = CoverageData() new_data.read_file(f) data.update(new_data, aliases=aliases) |