summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS.txt2
-rw-r--r--CHANGES.txt3
-rw-r--r--coverage/results.py7
-rw-r--r--tests/test_summary.py9
4 files changed, 12 insertions, 9 deletions
diff --git a/AUTHORS.txt b/AUTHORS.txt
index a30f377..08b8a2b 100644
--- a/AUTHORS.txt
+++ b/AUTHORS.txt
@@ -24,6 +24,7 @@ Roger Hu
Stan Hu
Devin Jeanpierre
Ross Lawley
+Steve Leonard
Edward Loper
Sandra Martocchia
Patrick Mezard
@@ -43,4 +44,3 @@ Sigve Tjora
Mark van der Wal
Zooko Wilcox-O'Hearn
Christoph Zwerschke
-Steve Leonard
diff --git a/CHANGES.txt b/CHANGES.txt
index 491c853..44f350a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -8,6 +8,9 @@ Change history for Coverage.py
- Python versions supported are now CPython 2.6, 2.7, 3.2, 3.3, and 3.4, and
PyPy 2.2.
+- The ``report`` command can now show missing branches when reporting on branch
+ coverage. Thanks, Steve Leonard.
+
- The XML report now contains a <source> element, fixing `issue 94`_. Thanks
Stan Hu.
diff --git a/coverage/results.py b/coverage/results.py
index 94785ca..c9034bc 100644
--- a/coverage/results.py
+++ b/coverage/results.py
@@ -90,12 +90,11 @@ class Analysis(object):
"""
arcs = self.missing_branch_arcs()
- line_exits = sorted(arcs.iteritems(), key=lambda (x, _): x)
+ line_exits = sorted(iitems(arcs))
pairs = []
for line, exits in line_exits:
- exits = sorted(exits)
- for exit in exits:
- pair = '%d->%d' % (line, exit)
+ for ex in sorted(exits):
+ pair = '%d->%d' % (line, ex)
pairs.append(pair)
return ', '.join(pairs)
diff --git a/tests/test_summary.py b/tests/test_summary.py
index 88be776..2ceaffd 100644
--- a/tests/test_summary.py
+++ b/tests/test_summary.py
@@ -92,7 +92,9 @@ class SummaryTest(CoverageTest):
# Try reporting while omitting some modules
prefix = os.path.split(__file__)[0]
self.run_command("coverage run mycode.py")
- report = self.report_from_command("coverage report --omit '%s/*'" % prefix)
+ report = self.report_from_command(
+ "coverage report --omit '%s/*'" % prefix
+ )
# Name Stmts Miss Cover
# ----------------------------
@@ -151,7 +153,6 @@ class SummaryTest(CoverageTest):
if y:
print("y")
return x
- return y
missing(0, 1)
""")
out = self.run_command("coverage run mymissing.py")
@@ -160,12 +161,12 @@ class SummaryTest(CoverageTest):
# Name Stmts Miss Cover Missing
# -----------------------------------------
- # mymissing 9 3 67% 3-4, 8
+ # mymissing 8 2 75% 3-4
self.assertEqual(self.line_count(report), 3)
self.assertIn("mymissing ", report)
self.assertEqual(self.last_line_squeezed(report),
- "mymissing 9 3 67% 3-4, 8")
+ "mymissing 8 2 75% 3-4")
def test_report_show_missing_branches(self):
self.make_file("mybranch.py", """\