From 57e762c85d767eba791782596665d3e6980c83a7 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 18 Jun 2019 17:35:18 -0400 Subject: 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)". --- coverage/html.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'coverage/html.py') 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 -- cgit v1.2.1