summaryrefslogtreecommitdiff
path: root/coverage/html.py
diff options
context:
space:
mode:
authorloic@dachary.org <loic@dachary.org>2017-01-11 00:45:04 +0100
committerloic@dachary.org <loic@dachary.org>2017-01-11 00:45:04 +0100
commite7faaa5a1e2e316ec7ec215946a291711f397a32 (patch)
tree539b21c7541ba6653b42b4f66ef410f9056a6654 /coverage/html.py
parentf0337bcc49ebd1664ea967bca9044af501a45e7c (diff)
downloadpython-coveragepy-git-e7faaa5a1e2e316ec7ec215946a291711f397a32.tar.gz
html total must account for files 100% covered #549
The --skip-covered implementation for html must not just skip the files that are 100% covered. It must remember them and not fail with a "no coverage data" when all files are 100% covered. The statistics about the files that are 100% covered must also be summed in the total for the index.html page. close #549 --HG-- branch : issue-549
Diffstat (limited to 'coverage/html.py')
-rw-r--r--coverage/html.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/coverage/html.py b/coverage/html.py
index 22783ef7..4a8c5a5f 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -105,6 +105,7 @@ class HtmlReporter(Reporter):
self.coverage = cov
self.files = []
+ self.files_skip_covered = []
self.has_arcs = self.coverage.data.has_arcs()
self.status = HtmlStatus()
self.extra_css = None
@@ -137,7 +138,7 @@ class HtmlReporter(Reporter):
# Process all the files.
self.report_files(self.html_file, morfs, self.config.html_dir)
- if not self.files:
+ if not self.files and not self.files_skip_covered:
raise CoverageException("No data to report.")
# Write the index file.
@@ -178,6 +179,7 @@ class HtmlReporter(Reporter):
no_missing_lines = (nums.n_missing == 0)
no_missing_branches = (nums.n_partial_branches == 0)
if no_missing_lines and no_missing_branches:
+ self.files_skip_covered.append(nums)
return
source = fr.source()
@@ -292,7 +294,7 @@ class HtmlReporter(Reporter):
"""Write the index.html file for this report."""
index_tmpl = Templite(read_data("index.html"), self.template_globals)
- self.totals = sum(f['nums'] for f in self.files)
+ self.totals = sum([f['nums'] for f in self.files] + self.files_skip_covered)
html = index_tmpl.render({
'has_arcs': self.has_arcs,