diff options
Diffstat (limited to 'coverage/html.py')
-rw-r--r-- | coverage/html.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/coverage/html.py b/coverage/html.py index 96282161..9022ac4f 100644 --- a/coverage/html.py +++ b/coverage/html.py @@ -1,7 +1,9 @@ -"""HTML reporting for Coverage.""" +# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0 +# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt -from __future__ import unicode_literals +"""HTML reporting for coverage.py.""" +import datetime import json import os import re @@ -92,6 +94,7 @@ class HtmlReporter(Reporter): self.status = HtmlStatus() self.extra_css = None self.totals = Numbers() + self.time_stamp = datetime.datetime.now().strftime('%Y-%m-%d %H:%M') def report(self, morfs): """Generate an HTML report for `morfs`. @@ -126,8 +129,7 @@ class HtmlReporter(Reporter): self.index_file() self.make_local_static_report_files() - - return self.totals.pc_covered + return self.totals.n_statements and self.totals.pc_covered def make_local_static_report_files(self): """Make local instances of static files for HTML report.""" @@ -221,7 +223,7 @@ class HtmlReporter(Reporter): else: tok_html = escape(tok_text) or ' ' html.append( - "<span class='%s'>%s</span>" % (tok_type, tok_html) + '<span class="%s">%s</span>' % (tok_type, tok_html) ) lines.append({ @@ -237,6 +239,7 @@ class HtmlReporter(Reporter): 'c_exc': c_exc, 'c_mis': c_mis, 'c_par': c_par, 'c_run': c_run, 'arcs': self.arcs, 'extra_css': self.extra_css, 'fr': fr, 'nums': nums, 'lines': lines, + 'time_stamp': self.time_stamp, } html = spaceless(self.source_tmpl.render(template_values)) @@ -248,7 +251,7 @@ class HtmlReporter(Reporter): index_info = { 'nums': nums, 'html_filename': html_filename, - 'name': fr.name, + 'relative_filename': fr.relative_filename(), } self.files.append(index_info) self.status.set_index_info(flat_rootname, index_info) @@ -266,6 +269,7 @@ class HtmlReporter(Reporter): 'extra_css': self.extra_css, 'files': self.files, 'totals': self.totals, + 'time_stamp': self.time_stamp, }) self.write_html( |