From e432a86f71929dc3ec00ab1664783aaa1afbcc8d Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 27 Sep 2009 10:01:05 -0400 Subject: Added a 'coverage debug' command to get internal information for diagnosing problems. Also, all commands should at least take -h. --- coverage/data.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'coverage/data.py') 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 -- cgit v1.2.1