summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve <sleonard76@gmail.com>2014-05-23 17:04:08 -0400
committerSteve <sleonard76@gmail.com>2014-05-23 17:04:08 -0400
commitc6a47d49e3ac32de75859e3439cd0fe96f0c4460 (patch)
treec8df935a8a90ef2f5d3483a9fff4afc1eb1d5683
parente8ae0fd9eab531a700fe00a0d8b8ce185f8f24c0 (diff)
downloadpython-coveragepy-git-c6a47d49e3ac32de75859e3439cd0fe96f0c4460.tar.gz
Add branch misses to stdout report
-rw-r--r--coverage/results.py14
-rw-r--r--coverage/summary.py4
2 files changed, 18 insertions, 0 deletions
diff --git a/coverage/results.py b/coverage/results.py
index ce9e0fa4..676ba716 100644
--- a/coverage/results.py
+++ b/coverage/results.py
@@ -83,6 +83,20 @@ class Analysis(object):
)
return sorted(missing)
+ def arcs_missing_formatted(self):
+ """ The missing branch arcs, formatted.
+
+ Returns a string like "1->2, 1->3, 16->20"
+
+ """
+ arcs = self.missing_branch_arcs()
+ pairs = []
+ for line, exits in arcs.iteritems():
+ for exit in exits:
+ pair = '%d->%d' % (line, exit)
+ pairs.append(pair)
+ return ', '.join(pairs)
+
def arcs_unpredicted(self):
"""Returns a sorted list of the executed arcs missing from the code."""
possible = self.arc_possibilities()
diff --git a/coverage/summary.py b/coverage/summary.py
index c99c5303..3588d31b 100644
--- a/coverage/summary.py
+++ b/coverage/summary.py
@@ -37,6 +37,8 @@ class SummaryReporter(Reporter):
if self.config.show_missing:
header += " Missing"
fmt_coverage += " %s"
+ if self.branches:
+ fmt_coverage += ", Branches: %s"
rule = "-" * len(header) + "\n"
header += "\n"
fmt_coverage += "\n"
@@ -60,6 +62,8 @@ class SummaryReporter(Reporter):
args += (nums.pc_covered_str,)
if self.config.show_missing:
args += (analysis.missing_formatted(),)
+ if self.branches:
+ args += (analysis.arcs_missing_formatted(),)
outfile.write(fmt_coverage % args)
total += nums
except KeyboardInterrupt: # pragma: not covered