Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: expect_tests/cover.py

Issue 2036823002: expect_tests > coverage: no data, no fail (Closed) Base URL: https://chromium.googlesource.com/infra/testing/expect_tests.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: expect_tests/cover.py
diff --git a/expect_tests/cover.py b/expect_tests/cover.py
index dee4f16a05cc3991720c38573f112a368a33d670..2cfe6968434739a5ca31a2c9a4b6b293bbfcc1db 100644
--- a/expect_tests/cover.py
+++ b/expect_tests/cover.py
@@ -110,7 +110,16 @@ 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 CoverageException as ce:
+ # If we have no data to report, this means that coverage has found no
+ # tests in the module. This is not nice, but we shouldn't fail.
+ if ce.message == 'No data to report.':
+ return
+ raise
+
fail = coverage_percent < self.expected_coverage_min
summary = outf.getvalue().replace('%- 15s' % 'Name', 'Coverage Report', 1)
if verbose:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698