summaryrefslogtreecommitdiff
path: root/coverage/html.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2019-06-18 17:35:18 -0400
committerNed Batchelder <ned@nedbatchelder.com>2019-06-30 22:36:27 -0400
commit57e762c85d767eba791782596665d3e6980c83a7 (patch)
tree90427c199e2f31f4985e1c63e5dfc570adbba714 /coverage/html.py
parent201f5e93cde09c1fe613e33e0529cf0390cdb09c (diff)
downloadpython-coveragepy-git-57e762c85d767eba791782596665d3e6980c83a7.tar.gz
Context reporting improvements and test
Contexts should only be reported on lines that are marked as executed. The empty outer context is now reported as "(empty)".
Diffstat (limited to 'coverage/html.py')
-rw-r--r--coverage/html.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/coverage/html.py b/coverage/html.py
index 78c982a2..cff2419d 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -116,8 +116,8 @@ class HtmlDataGeneration(object):
elif lineno in analysis.statements:
category = 'run'
- if self.config.show_contexts:
- contexts = sorted(filter(None, contexts_by_lineno[lineno]))
+ if category and self.config.show_contexts:
+ contexts = sorted(c or "(empty)" for c in contexts_by_lineno[lineno])
else:
contexts = None