summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
authorIonel Cristian Maries <contact@ionelmc.ro>2015-06-28 22:41:53 +0300
committerIonel Cristian Maries <contact@ionelmc.ro>2015-06-28 22:41:53 +0300
commitd20a77c9cf1bdba8cf003f24681503313253389b (patch)
tree321a83657c2b7d79046711afc17eb2d7bd04a5ff /coverage
parent7840acda324d863009f12df2aaec5d1079cc5919 (diff)
downloadpython-coveragepy-git-d20a77c9cf1bdba8cf003f24681503313253389b.tar.gz
Make return codes consistent: 1 for no data and 2 for fail_under. Now the `report` command will properly report `No data to report` if there's no data.
Diffstat (limited to 'coverage')
-rw-r--r--coverage/html.py3
-rw-r--r--coverage/summary.py3
2 files changed, 3 insertions, 3 deletions
diff --git a/coverage/html.py b/coverage/html.py
index 9148f422..da23935d 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -126,8 +126,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."""
diff --git a/coverage/summary.py b/coverage/summary.py
index aed83350..20123ea1 100644
--- a/coverage/summary.py
+++ b/coverage/summary.py
@@ -98,5 +98,6 @@ class SummaryReporter(Reporter):
if self.config.show_missing:
args += ("",)
outfile.write(fmt_coverage % args)
-
+ if not total.n_files:
+ raise CoverageException("No data to report.")
return total.n_statements and total.pc_covered