diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-27 10:01:05 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2009-09-27 10:01:05 -0400 |
commit | e432a86f71929dc3ec00ab1664783aaa1afbcc8d (patch) | |
tree | 4181c48059649d1a2b8b599f902cc023e6275826 /coverage/data.py | |
parent | 7f8bf5fe9cd67a6654f6b5993adec919ff16e23e (diff) | |
download | python-coveragepy-git-e432a86f71929dc3ec00ab1664783aaa1afbcc8d.tar.gz |
Added a 'coverage debug' command to get internal information for diagnosing problems. Also, all commands should at least take -h.
Diffstat (limited to 'coverage/data.py')
-rw-r--r-- | coverage/data.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/coverage/data.py b/coverage/data.py index 4d368f55..54979658 100644 --- a/coverage/data.py +++ b/coverage/data.py @@ -164,14 +164,19 @@ class CoverageData: """ return self.lines.get(filename) or {} - def summary(self): + def summary(self, fullpath=False): """Return a dict summarizing the coverage data. - Keys are the basename of the filenames, and values are the number of - executed lines. This is useful in the unit tests. + Keys are based on the filenames, and values are the number of executed + lines. If `fullpath` is true, then the keys are the full pathnames of + the files, otherwise they are the basenames of the files. """ summ = {} + if fullpath: + filename_fn = lambda f: f + else: + filename_fn = os.path.basename for filename, lines in self.lines.items(): - summ[os.path.basename(filename)] = len(lines) + summ[filename_fn(filename)] = len(lines) return summ |