summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--coverage/html.py5
-rw-r--r--coverage/plugin.py15
-rw-r--r--coverage/python.py6
-rw-r--r--tests/test_html.py6
5 files changed, 27 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index e90d55df..915537fe 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,7 @@ clean:
-rm -f *.pyd */*.pyd
-rm -f *.so */*.so
-PYTHONPATH=. python tests/test_farm.py clean
+ -rm -rf tests/farm/*/out
-rm -rf build coverage.egg-info dist htmlcov
-rm -f *.pyc */*.pyc */*/*.pyc */*/*/*.pyc */*/*/*/*.pyc */*/*/*/*/*.pyc
-rm -f *.pyo */*.pyo */*/*.pyo */*/*/*.pyo */*/*/*/*.pyo */*/*/*/*/*.pyo
diff --git a/coverage/html.py b/coverage/html.py
index ce394530..19898cbe 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -218,16 +218,15 @@ class HtmlReporter(Reporter):
for b in missing_branch_arcs[lineno]:
if b < 0:
shorts.append("exit")
- longs.append("the function exit")
else:
shorts.append(b)
- longs.append("line %d" % b)
+ longs.append(fr.arc_destination_description(b))
# 202F is NARROW NO-BREAK SPACE.
# 219B is RIGHTWARDS ARROW WITH STROKE.
short_fmt = "%s&#x202F;&#x219B;&#x202F;%s"
annotate_html = ",&nbsp;&nbsp; ".join(short_fmt % (lineno, d) for d in shorts)
- annotate_long = "Line %d was executed, but never jumped to " % lineno
+ annotate_long = "Line %d was executed, but didn't " % lineno
if len(longs) == 1:
annotate_long += longs[0]
elif len(longs) == 2:
diff --git a/coverage/plugin.py b/coverage/plugin.py
index f870c254..095b268c 100644
--- a/coverage/plugin.py
+++ b/coverage/plugin.py
@@ -329,6 +329,21 @@ class FileReporter(object):
"""
return {}
+ def arc_destination_description(self, lineno):
+ """Provide an English phrase describing an arc destination.
+
+ For an arc like (123, 456), it should read well to use the phrase like
+ this::
+
+ "Line {0} didn't {1}".format(123, arc_destination_description(456))
+
+ TODO: say more.
+
+ By default, this simply returns the string "jump to {lineno}".
+
+ """
+ return "jump to line {lineno}".format(lineno=lineno)
+
def source_token_lines(self):
"""Generate a series of tokenized lines, one for each line in `source`.
diff --git a/coverage/python.py b/coverage/python.py
index 07d23472..f50d4d94 100644
--- a/coverage/python.py
+++ b/coverage/python.py
@@ -165,6 +165,12 @@ class PythonFileReporter(FileReporter):
def exit_counts(self):
return self.parser.exit_counts()
+ def arc_destination_description(self, lineno):
+ if lineno < 0:
+ return "jump to the function exit"
+ else:
+ return "jump to line {lineno}".format(lineno=lineno)
+
@contract(returns='unicode')
def source(self):
if self._source is None:
diff --git a/tests/test_html.py b/tests/test_html.py
index d96804d6..704f023a 100644
--- a/tests/test_html.py
+++ b/tests/test_html.py
@@ -526,14 +526,14 @@ class HtmlGoldTests(CoverageGoldTest):
'<span class="pc_cov">70%</span>',
('<span class="annotate short">8&#x202F;&#x219B;&#x202F;11</span>'
'<span class="annotate long">Line 8 was executed, '
- 'but never jumped to line 11</span>'),
+ 'but didn\'t jump to line 11</span>'),
('<span class="annotate short">17&#x202F;&#x219B;&#x202F;exit</span>'
'<span class="annotate long">Line 17 was executed, '
- 'but never jumped to the function exit</span>'),
+ 'but didn\'t jump to the function exit</span>'),
('<span class="annotate short">25&#x202F;&#x219B;&#x202F;26,&nbsp;&nbsp; '
'25&#x202F;&#x219B;&#x202F;28</span>'
'<span class="annotate long">Line 25 was executed, '
- 'but never jumped to line 26 or line 28</span'),
+ 'but didn\'t jump to line 26 or jump to line 28</span'),
)
contains(
"out/b_branch/index.html",