diff options
-rw-r--r-- | CHANGES.rst | 5 | ||||
-rw-r--r-- | coverage/results.py | 2 | ||||
-rw-r--r-- | tests/test_summary.py | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 222a63ee..3873d298 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,11 +30,16 @@ Unreleased indents was fixed. The index page also has slightly different styling, to try to make the clickable detail pages more apparent. +- Missing branches reported with ``coverage report -m`` will now say ``->exit`` + for missed branches to the exit of a function, rather than a negative number. + Fixes `issue 469`_. + - ``coverage --help`` and ``coverage --version`` now mention which tracer is installed, to help diagnose problems. The docs mention which features need the C extension. (`issue 479`_) .. _issue 440: https://bitbucket.org/ned/coveragepy/issues/440/yielded-twisted-failure-marked-as-missed +.. _issue 469: https://bitbucket.org/ned/coveragepy/issues/469/strange-1-line-number-in-branch-coverage .. _issue 472: https://bitbucket.org/ned/coveragepy/issues/472/html-report-indents-incorrectly-for-one .. _issue 475: https://bitbucket.org/ned/coveragepy/issues/475/generator-expression-is-marked-as-not .. _issue 479: https://bitbucket.org/ned/coveragepy/issues/479/clarify-the-need-for-the-c-extension diff --git a/coverage/results.py b/coverage/results.py index dc93f3fe..7853848a 100644 --- a/coverage/results.py +++ b/coverage/results.py @@ -96,7 +96,7 @@ class Analysis(object): for line, exits in line_exits: for ex in sorted(exits): if line not in missing: - pairs.append('%d->%d' % (line, ex)) + pairs.append("%d->%s" % (line, (ex if ex > 0 else "exit"))) return ', '.join(pairs) def arcs_unpredicted(self): diff --git a/tests/test_summary.py b/tests/test_summary.py index 89a8443c..681e2042 100644 --- a/tests/test_summary.py +++ b/tests/test_summary.py @@ -182,7 +182,6 @@ class SummaryTest(CoverageTest): print("x") if y: print("y") - return x branch(1, 1) """) out = self.run_command("coverage run --branch mybranch.py") @@ -191,11 +190,11 @@ class SummaryTest(CoverageTest): # Name Stmts Miss Branch BrPart Cover Missing # ---------------------------------------------------------- - # mybranch.py 7 0 4 2 82% 2->4, 4->6 + # mybranch.py 6 0 4 2 80% 2->4, 4->exit self.assertEqual(self.line_count(report), 3) self.assertIn("mybranch.py ", report) - self.assertEqual(self.last_line_squeezed(report), "mybranch.py 7 0 4 2 82% 2->4, 4->6") + self.assertEqual(self.last_line_squeezed(report), "mybranch.py 6 0 4 2 80% 2->4, 4->exit") def test_report_show_missing_branches_and_lines(self): self.make_file("main.py", """\ |