summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2014-07-08 06:25:17 -0400
committerNed Batchelder <ned@nedbatchelder.com>2014-07-08 06:25:17 -0400
commitc317727542e303ae9dd5ed4db73217508e367d74 (patch)
treea10fcf53481e773f1ab97eef8188b89172a68404 /coverage
parenta63bf56c15835c763f60ff0ba3f782c8fb86363c (diff)
downloadpython-coveragepy-git-c317727542e303ae9dd5ed4db73217508e367d74.tar.gz
Improve branch summarization
It failed completely on more than one file! Removed the Branches label, and no longer report missing branches implied by missing lines.
Diffstat (limited to 'coverage')
-rw-r--r--coverage/results.py10
-rw-r--r--coverage/summary.py13
2 files changed, 12 insertions, 11 deletions
diff --git a/coverage/results.py b/coverage/results.py
index c9034bcd..6cbcbfc8 100644
--- a/coverage/results.py
+++ b/coverage/results.py
@@ -84,18 +84,20 @@ class Analysis(object):
return sorted(missing)
def arcs_missing_formatted(self):
- """ The missing branch arcs, formatted.
+ """ The missing branch arcs, formatted nicely.
- Returns a string like "1->2, 1->3, 16->20"
+ Returns a string like "1->2, 1->3, 16->20". Omits any mention of
+ missing lines, so if line 17 is missing, then 16->17 won't be included.
"""
arcs = self.missing_branch_arcs()
+ missing = self.missing
line_exits = sorted(iitems(arcs))
pairs = []
for line, exits in line_exits:
for ex in sorted(exits):
- pair = '%d->%d' % (line, ex)
- pairs.append(pair)
+ if line not in missing and ex not in missing:
+ pairs.append('%d->%d' % (line, ex))
return ', '.join(pairs)
def arcs_unpredicted(self):
diff --git a/coverage/summary.py b/coverage/summary.py
index 1e55a7d4..a6768cf9 100644
--- a/coverage/summary.py
+++ b/coverage/summary.py
@@ -37,8 +37,6 @@ class SummaryReporter(Reporter):
if self.config.show_missing:
header += " Missing"
fmt_coverage += " %s"
- if self.branches:
- fmt_coverage += "%sBranches: %s"
rule = "-" * len(header) + "\n"
header += "\n"
fmt_coverage += "\n"
@@ -62,12 +60,13 @@ class SummaryReporter(Reporter):
args += (nums.pc_covered_str,)
if self.config.show_missing:
missing_fmtd = analysis.missing_formatted()
- args += (missing_fmtd,)
if self.branches:
- separator = ""
- if missing_fmtd:
- separator = ", "
- args += (separator, analysis.arcs_missing_formatted(),)
+ branches_fmtd = analysis.arcs_missing_formatted()
+ if branches_fmtd:
+ if missing_fmtd:
+ missing_fmtd += ", "
+ missing_fmtd += branches_fmtd
+ args += (missing_fmtd,)
outfile.write(fmt_coverage % args)
total += nums
except KeyboardInterrupt: # pragma: not covered