From 9c9ff1c8536d3066f2d94d3835664783494ed040 Mon Sep 17 00:00:00 2001 From: Chris Adams Date: Thu, 19 Nov 2009 14:50:08 -0500 Subject: Better HTML reporting imported patch TweakedReports --- coverage/html.py | 8 +- coverage/htmlfiles/index.html | 141 +++++++++++++++------------ coverage/htmlfiles/jquery.tablesorter.min.js | 2 + 3 files changed, 89 insertions(+), 62 deletions(-) create mode 100644 coverage/htmlfiles/jquery.tablesorter.min.js diff --git a/coverage/html.py b/coverage/html.py index 8c274728..146b389b 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -50,11 +50,15 @@ class HtmlReporter(Reporter): # Create the once-per-directory files. shutil.copyfile( data_filename("htmlfiles/style.css"), - os.path.join(directory, "style.css") + os.path.join(directory, "style.css") ) shutil.copyfile( data_filename("htmlfiles/jquery-1.3.2.min.js"), - os.path.join(directory, "jquery-1.3.2.min.js") + os.path.join(directory, "jquery-1.3.2.min.js") + ) + shutil.copyfile( + data_filename("htmlfiles/jquery.tablesorter.min.js"), + os.path.join(directory, "jquery.tablesorter.min.js") ) def html_file(self, cu, analysis): diff --git a/coverage/htmlfiles/index.html b/coverage/htmlfiles/index.html index 92b89444..162f862c 100644 --- a/coverage/htmlfiles/index.html +++ b/coverage/htmlfiles/index.html @@ -1,67 +1,88 @@ - - -Coverage report - - - + + + Coverage report + + + + + - + -
- - - - - - - {% if arcs %} - - - {% endif %} - - -{% for file in files %} - - - - - - {% if arcs %} - - - {% endif %} - - -{% endfor %} - - - - - -{% if arcs %} - - -{% endif %} - - -
Modulestatementsrunexcludedbranchesbr execcoverage
{{file.cu.name}}{{file.nums.n_statements}}{{file.nums.n_executed}}{{file.nums.n_excluded}}{{file.nums.n_branches}}{{file.nums.n_executed_branches}}{{file.nums.pc_covered|format_pct}}%
Total{{totals.n_statements}}{{totals.n_executed}}{{totals.n_excluded}}{{totals.n_branches}}{{totals.n_executed_branches}}{{totals.pc_covered|format_pct}}%
-
+
+ + + + + + + + {% if arcs %} + + + {% endif %} + + + + + {% for file in files %} + + + + + + {% if arcs %} + + + {% endif %} + + + {% endfor %} + + + + + + + + {% if arcs %} + + + {% endif %} + + + +
Modulestatementsrunexcludedbranchesbr execcoverage
{{file.cu.name}}{{file.nums.n_statements}}{{file.nums.n_executed}}{{file.nums.n_excluded}}{{file.nums.n_branches}}{{file.nums.n_executed_branches}}{{file.nums.pc_covered|format_pct}}%
Total{{totals.n_statements}}{{totals.n_executed}}{{totals.n_excluded}}{{totals.n_branches}}{{totals.n_executed_branches}}{{totals.pc_covered|format_pct}}%
+
- + - + + diff --git a/coverage/htmlfiles/jquery.tablesorter.min.js b/coverage/htmlfiles/jquery.tablesorter.min.js new file mode 100644 index 00000000..64c70071 --- /dev/null +++ b/coverage/htmlfiles/jquery.tablesorter.min.js @@ -0,0 +1,2 @@ + +(function($){$.extend({tablesorter:new function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'.',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}var rows=table.tBodies[0].rows;if(table.tBodies[0].rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;ib)?1:0));};function sortTextDesc(a,b){return((ba)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){$this.trigger("sortStart");var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){var $cell=$(this);var i=this.column;this.order=this.count++%2;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i Date: Fri, 20 Nov 2009 05:29:01 -0500 Subject: Bump the version number. --- CHANGES.txt | 6 ++++++ coverage/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index f76aa6ec..2bc2a400 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -2,6 +2,12 @@ Change history for Coverage.py ------------------------------ +Version 3.2b3 +------------- + +- None yet. + + Version 3.2b2, 19 November 2009 ------------------------------- diff --git a/coverage/__init__.py b/coverage/__init__.py index 9f399cbe..7deeff50 100644 --- a/coverage/__init__.py +++ b/coverage/__init__.py @@ -5,7 +5,7 @@ http://nedbatchelder.com/code/coverage """ -__version__ = "3.2b2" # see detailed history in CHANGES.txt +__version__ = "3.2b3" # see detailed history in CHANGES.txt __url__ = "http://nedbatchelder.com/code/coverage" -- cgit v1.2.1 From 7a275ee31aaa0434d3beae1b1b259d21cd56f142 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 20 Nov 2009 05:32:33 -0500 Subject: rozza == Ross Lawley --- CHANGES.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 2bc2a400..63333d99 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -50,7 +50,8 @@ Version 3.2b1, 10 November 2009 Version 3.1, 4 October 2009 --------------------------- -- Source code can now be read from eggs. Thanks, rozza. Fixes `issue 25`_ +- Source code can now be read from eggs. Thanks, Ross Lawley. Fixes + `issue 25`_. .. _issue 25: http://bitbucket.org/ned/coveragepy/issue/25 -- cgit v1.2.1 From 18b7a2a764c829d50fcf1aee65e962fd64c344a7 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 20 Nov 2009 05:52:48 -0500 Subject: Odd indentation, fix it. --- coverage/html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coverage/html.py b/coverage/html.py index 146b389b..5e480011 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -50,15 +50,15 @@ class HtmlReporter(Reporter): # Create the once-per-directory files. shutil.copyfile( data_filename("htmlfiles/style.css"), - os.path.join(directory, "style.css") + os.path.join(directory, "style.css") ) shutil.copyfile( data_filename("htmlfiles/jquery-1.3.2.min.js"), - os.path.join(directory, "jquery-1.3.2.min.js") + os.path.join(directory, "jquery-1.3.2.min.js") ) shutil.copyfile( data_filename("htmlfiles/jquery.tablesorter.min.js"), - os.path.join(directory, "jquery.tablesorter.min.js") + os.path.join(directory, "jquery.tablesorter.min.js") ) def html_file(self, cu, analysis): -- cgit v1.2.1 From 5dc96eaae9966d08dafccdc676d4ad8fdc6484d4 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Fri, 20 Nov 2009 06:50:12 -0500 Subject: Polish up the sortable report: indication of sort column and sortability --- CHANGES.txt | 5 +++- coverage/html.py | 19 +++++--------- coverage/htmlfiles/index.html | 19 +++++++------- coverage/htmlfiles/style.css | 59 ++++++++++++++++++++++++++----------------- 4 files changed, 57 insertions(+), 45 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 63333d99..be3e7530 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -5,7 +5,10 @@ Change history for Coverage.py Version 3.2b3 ------------- -- None yet. +- The table of contents in the HTML report is now sortable. Thanks, + `Chris Adams`_. + +.. _Chris Adams: http://improbable.org/chris/ Version 3.2b2, 19 November 2009 diff --git a/coverage/html.py b/coverage/html.py index 5e480011..3877c834 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -48,18 +48,13 @@ class HtmlReporter(Reporter): self.index_file() # Create the once-per-directory files. - shutil.copyfile( - data_filename("htmlfiles/style.css"), - os.path.join(directory, "style.css") - ) - shutil.copyfile( - data_filename("htmlfiles/jquery-1.3.2.min.js"), - os.path.join(directory, "jquery-1.3.2.min.js") - ) - shutil.copyfile( - data_filename("htmlfiles/jquery.tablesorter.min.js"), - os.path.join(directory, "jquery.tablesorter.min.js") - ) + for static in [ + "style.css", "jquery-1.3.2.min.js", "jquery.tablesorter.min.js" + ]: + shutil.copyfile( + data_filename("htmlfiles/" + static), + os.path.join(directory, static) + ) def html_file(self, cu, analysis): """Generate an HTML file for one source file.""" diff --git a/coverage/htmlfiles/index.html b/coverage/htmlfiles/index.html index 162f862c..5c562de2 100644 --- a/coverage/htmlfiles/index.html +++ b/coverage/htmlfiles/index.html @@ -20,8 +20,9 @@
- - + {# The title='' attr doesn't work in Safari. #} + + @@ -29,13 +30,13 @@ {% endif %} - + {% for file in files %} - + @@ -43,13 +44,13 @@ {% endif %} - + {% endfor %} - + @@ -57,7 +58,7 @@ {% endif %} - +
Module
Module statements run excludedbranches br execcoveragecoverage
{{file.cu.name}}{{file.cu.name}} {{file.nums.n_statements}} {{file.nums.n_executed}} {{file.nums.n_excluded}}{{file.nums.n_branches}} {{file.nums.n_executed_branches}}{{file.nums.pc_covered|format_pct}}%{{file.nums.pc_covered|format_pct}}%
TotalTotal {{totals.n_statements}} {{totals.n_executed}} {{totals.n_excluded}}{{totals.n_branches}} {{totals.n_executed_branches}}{{totals.pc_covered|format_pct}}%{{totals.pc_covered|format_pct}}%
@@ -75,11 +76,11 @@ jQuery(function() { jQuery("table.index").tablesorter({ headers: { - 0: { sorter:'test' }, + 0: { sorter:'text' }, 1: { sorter:'digit' }, 2: { sorter:'digit' }, 3: { sorter:'digit' }, - 4: { sorter:'digit' }, + 4: { sorter:'percent' }, } }); }); diff --git a/coverage/htmlfiles/style.css b/coverage/htmlfiles/style.css index 65a27905..dd6c991a 100644 --- a/coverage/htmlfiles/style.css +++ b/coverage/htmlfiles/style.css @@ -2,14 +2,14 @@ /* Page-wide styles */ html, body, h1, h2, h3, p, td, th { margin: 0; - padding: 0; - border: 0; - outline: 0; - font-weight: inherit; - font-style: inherit; - font-size: 100%; - font-family: inherit; - vertical-align: baseline; + padding: 0; + border: 0; + outline: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; } /* Set baseline grid to 16 pt. */ @@ -134,16 +134,16 @@ td.text { } .text span.annotate { - font-family: georgia; - font-style: italic; - color: #666; - float: right; - padding-right: .5em; - } + font-family: georgia; + font-style: italic; + color: #666; + float: right; + padding-right: .5em; + } .text p.hide span.annotate { - display: none; - } - + display: none; + } + /* Syntax coloring */ .text .com { color: green; @@ -161,14 +161,28 @@ td.text { /* index styles */ #index td, #index th { text-align: right; - width: 6em; - padding: .25em 0; + width: 5em; + padding: .25em .5em; border-bottom: 1px solid #eee; } #index th { font-style: italic; color: #333; border-bottom: 1px solid #ccc; + cursor: pointer; + } +#index th:hover { + background: #eee; + border-bottom: 1px solid #999; + } +#index td.left, #index th.left { + padding-left: 0; + } +#index td.right, #index th.right { + padding-right: 0; + } +#index th.headerSortDown, #index th.headerSortUp { + border-bottom: 1px solid #000; } #index td.name, #index th.name { text-align: left; @@ -183,13 +197,12 @@ td.text { color: #000; } #index tr.total { - font-weight: bold; } #index tr.total td { - padding: .25em 0; + font-weight: bold; border-top: 1px solid #ccc; border-bottom: none; } #index tr.file:hover { - background: #eeeeee; - } + background: #eeeeee; + } -- cgit v1.2.1