diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-20 22:31:12 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2014-10-20 22:31:12 -0400 |
commit | 6c3042ad6f61af8027cf3d4c513d914d9620b896 (patch) | |
tree | a100535cc7c1f205882a7cdaf42c394b01d9bf8c | |
parent | a2db5014858f024b6866cf54bb9b09509aca9c18 (diff) | |
download | python-coveragepy-git-6c3042ad6f61af8027cf3d4c513d914d9620b896.tar.gz |
Make the text report branch column match the HTML report
-rw-r--r-- | coverage/results.py | 5 | ||||
-rw-r--r-- | coverage/summary.py | 6 | ||||
-rw-r--r-- | doc/cmd.rst | 6 | ||||
-rw-r--r-- | tests/test_summary.py | 16 |
4 files changed, 17 insertions, 16 deletions
diff --git a/coverage/results.py b/coverage/results.py index 4449de56..6c41a944 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -86,7 +86,8 @@ class Analysis(object): """ The missing branch arcs, formatted nicely. 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. + branches from missing lines, so if line 17 is missing, then 17->18 + won't be included. """ arcs = self.missing_branch_arcs() @@ -95,7 +96,7 @@ class Analysis(object): pairs = [] for line, exits in line_exits: for ex in sorted(exits): - if line not in missing and ex not in missing: + if line not in missing: pairs.append('%d->%d' % (line, ex)) return ', '.join(pairs) diff --git a/coverage/summary.py b/coverage/summary.py index 9d31c226..a166ec2c 100644 --- a/coverage/summary.py +++ b/coverage/summary.py @@ -29,7 +29,7 @@ class SummaryReporter(Reporter): header = (fmt_name % "Name") + " Stmts Miss" fmt_coverage = fmt_name + "%6d %6d" if self.branches: - header += " Branch BrMiss" + header += " Branch BrPart" fmt_coverage += " %6d %6d" width100 = Numbers.pc_str_width() header += "%*s" % (width100+4, "Cover") @@ -56,7 +56,7 @@ class SummaryReporter(Reporter): nums = analysis.numbers args = (cu.name, nums.n_statements, nums.n_missing) if self.branches: - args += (nums.n_branches, nums.n_missing_branches) + args += (nums.n_branches, nums.n_partial_branches) args += (nums.pc_covered_str,) if self.config.show_missing: missing_fmtd = analysis.missing_formatted() @@ -84,7 +84,7 @@ class SummaryReporter(Reporter): outfile.write(rule) args = ("TOTAL", total.n_statements, total.n_missing) if self.branches: - args += (total.n_branches, total.n_missing_branches) + args += (total.n_branches, total.n_partial_branches) args += (total.pc_covered_str,) if self.config.show_missing: args += ("",) diff --git a/doc/cmd.rst b/doc/cmd.rst index cd6ae955..a4657c45 100644 --- a/doc/cmd.rst +++ b/doc/cmd.rst @@ -276,11 +276,11 @@ The ``-m`` flag also shows the line numbers of missing statements:: TOTAL 91 12 87% If you are using branch coverage, then branch statistics will be reported in -the Branch and BrMiss columns, the Missing column will detail the missed -branches:: +the Branch and BrPart (for Partial Branch) columns, the Missing column will +detail the missed branches:: $ coverage report -m - Name Stmts Miss Branch BrMiss Cover Missing + Name Stmts Miss Branch BrPart Cover Missing --------------------------------------------------------------------- my_program 20 4 10 2 80% 33-35, 36->38, 39 my_module 15 2 3 0 86% 8, 12 diff --git a/tests/test_summary.py b/tests/test_summary.py index 7bd1c496..ce668f76 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -119,7 +119,7 @@ class SummaryTest(CoverageTest): self.assertEqual(out, 'x\n') report = self.report_from_command("coverage report") - # Name Stmts Miss Branch BrMiss Cover + # Name Stmts Miss Branch BrPart Cover # -------------------------------------------- # mybranch 5 0 2 1 85% @@ -172,7 +172,7 @@ class SummaryTest(CoverageTest): self.assertEqual(out, 'x\ny\n') report = self.report_from_command("coverage report --show-missing") - # Name Stmts Miss Branch BrMiss Cover Missing + # Name Stmts Miss Branch BrPart Cover Missing # ------------------------------------------------------- # mybranch 7 0 4 2 82% 2->4, 4->6 @@ -202,12 +202,12 @@ class SummaryTest(CoverageTest): report = self.report_from_command("coverage report --show-missing") # pylint: disable=C0301 - # Name Stmts Miss Branch BrMiss Cover Missing + # Name Stmts Miss Branch BrPart Cover Missing # ------------------------------------------------------- # main 1 0 0 0 100% - # mybranch 10 2 8 5 61% 7-8, 2->4, 4->6 + # mybranch 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7 # ------------------------------------------------------- - # TOTAL 11 2 8 5 63% + # TOTAL 11 2 8 3 63% self.assertEqual(self.line_count(report), 6) squeezed = self.squeezed_lines(report) @@ -217,11 +217,11 @@ class SummaryTest(CoverageTest): ) self.assertEqual( squeezed[3], - "mybranch 10 2 8 5 61% 7-8, 2->4, 4->6" + "mybranch 10 2 8 3 61% 7-8, 2->4, 4->6, 6->7" ) self.assertEqual( squeezed[5], - "TOTAL 11 2 8 5 63%" + "TOTAL 11 2 8 3 63%" ) def test_dotpy_not_python(self): @@ -301,7 +301,7 @@ class SummaryTest(CoverageTest): import main # pragma: nested # pylint: disable=F0401,W0612 cov.stop() # pragma: nested report = self.get_report(cov).splitlines() - self.assertIn("mybranch 5 5 2 2 0%", report) + self.assertIn("mybranch 5 5 2 0 0%", report) def run_TheCode_and_report_it(self): """A helper for the next few tests.""" |