From 7dad73478b4bcaee894cd7c3a725f3e177dd90cf Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2009 09:39:28 -0400 Subject: Stupid simplistic not working yet branch reporting in HTML --- coverage/html.py | 12 +++++++++--- coverage/htmlfiles/pyfile.html | 1 + coverage/htmlfiles/style.css | 22 +++++++++++++--------- 3 files changed, 23 insertions(+), 12 deletions(-) (limited to 'coverage') diff --git a/coverage/html.py b/coverage/html.py index 99b291b4..df7bc03c 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -93,12 +93,16 @@ class HtmlReporter(Reporter): n_mis = len(analysis.missing) n_run = n_stm - n_mis pc_cov = analysis.percent_covered() - + + missing_branch_arcs = analysis.missing_branch_arcs() + n_par = len(missing_branch_arcs) + # These classes determine which lines are highlighted by default. c_run = " run hide" c_exc = " exc" c_mis = " mis" - + c_par = " par" + ws_tokens = [token.INDENT, token.DEDENT, token.NEWLINE, tokenize.NL] lines = [] line = [] @@ -120,7 +124,9 @@ class HtmlReporter(Reporter): line_class += c_exc if lineno in analysis.missing: line_class += c_mis - + if lineno in missing_branch_arcs: + line_class += c_par + lineinfo = { 'html': "".join(line), 'number': lineno, diff --git a/coverage/htmlfiles/pyfile.html b/coverage/htmlfiles/pyfile.html index a7cd1d3c..8a0dd4e9 100644 --- a/coverage/htmlfiles/pyfile.html +++ b/coverage/htmlfiles/pyfile.html @@ -29,6 +29,7 @@ function toggle_lines(btn, cls) { {{n_run}} run {{n_exc}} excluded {{n_mis}} missing + {{n_par}} partial diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 34ab10e3..b55e4992 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -125,23 +125,27 @@ td.text { background: #eeeeee; border-left: 2px solid #808080; } +.text p.par { + background: #ffffdd; + border-left: 2px solid #ffff00; + } .text p.hide { background: inherit; } /* Syntax coloring */ .text .com { - color: green; - font-style: italic; - line-height: 1px; - } + color: green; + font-style: italic; + line-height: 1px; + } .text .key { - font-weight: bold; - line-height: 1px; - } + font-weight: bold; + line-height: 1px; + } .text .str { - color: #000080; - } + color: #000080; + } /* index styles */ #index td, #index th { -- cgit v1.2.1