diff options
author | Stephan Richter <stephan.richter@gmail.com> | 2019-01-24 07:44:59 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2019-06-10 17:15:32 -0400 |
commit | 0f5c9347aa8c72d853f49761d5580a770c4fd39f (patch) | |
tree | 82e0a136a16456d2df85f803a3ed9dc3da66d5ee /coverage/html.py | |
parent | 5c157a28c46b2f5ed9e9051e5b6c8d461b490f1b (diff) | |
download | python-coveragepy-git-0f5c9347aa8c72d853f49761d5580a770c4fd39f.tar.gz |
Extend HTML report to to show contexts for every covered line.
Diffstat (limited to 'coverage/html.py')
-rw-r--r-- | coverage/html.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/coverage/html.py b/coverage/html.py index d5edd5f7..3cd47d5a 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -214,6 +214,9 @@ class HtmlReporter(Reporter): c_mis = "mis" c_par = "par " + c_run + # Lookup line number contexts. + contexts_by_lineno = analysis.data.contexts_by_lineno(fr.filename) + lines = [] for lineno, line in enumerate(fr.source_token_lines(), start=1): @@ -268,6 +271,7 @@ class HtmlReporter(Reporter): 'html': ''.join(html), 'number': lineno, 'class': ' '.join(line_class) or "pln", + 'contexts': sorted(filter(None, contexts_by_lineno[lineno])) or None, 'annotate': annotate_html, 'annotate_long': annotate_long, }) @@ -279,6 +283,7 @@ class HtmlReporter(Reporter): 'c_par': c_par, 'c_run': c_run, 'has_arcs': self.has_arcs, + 'show_contexts': self.config.show_contexts, 'extra_css': self.extra_css, 'fr': fr, 'nums': nums, |