| Index: expect_tests/cover.py
|
| diff --git a/expect_tests/cover.py b/expect_tests/cover.py
|
| index dee4f16a05cc3991720c38573f112a368a33d670..44d4a35631822b151185171f8c9c4aa59bffc933 100644
|
| --- a/expect_tests/cover.py
|
| +++ b/expect_tests/cover.py
|
| @@ -110,7 +110,19 @@ class CoverageContext(object):
|
| self.cov.html_report(directory=self.html_report)
|
|
|
| outf = StringIO()
|
| - coverage_percent = self.cov.report(file=outf, show_missing=True)
|
| +
|
| + try:
|
| + coverage_percent = self.cov.report(file=outf, show_missing=True)
|
| + except coverage.CoverageException as ce:
|
| + if ce.message != 'No data to report.':
|
| + raise
|
| + # If we have no data to report, this means that coverage has found no
|
| + # tests in the module. Earlier version of coverage used to return 100 in
|
| + # this case, so we simulate it to keep backward compatibility.
|
| + coverage_percent = 100.0
|
| + if verbose:
|
| + print 'No data to report, setting coverage to 100%'
|
| +
|
| fail = coverage_percent < self.expected_coverage_min
|
| summary = outf.getvalue().replace('%- 15s' % 'Name', 'Coverage Report', 1)
|
| if verbose:
|
|
|