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

Side by Side Diff: recipe_engine/third_party/expect_tests/cover.py

Issue 2655923003: [expect_tests] Add show_missing flag to coverage.report. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from cStringIO import StringIO 5 from cStringIO import StringIO
6 import os 6 import os
7 import socket 7 import socket
8 import threading 8 import threading
9 9
10 import coverage 10 import coverage
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 def report(self, verbose, threshold, omit=None): 77 def report(self, verbose, threshold, omit=None):
78 fail = False 78 fail = False
79 79
80 if self.enabled: 80 if self.enabled:
81 if self.html_report: 81 if self.html_report:
82 self.cov.html_report(directory=self.html_report, omit=omit) 82 self.cov.html_report(directory=self.html_report, omit=omit)
83 83
84 outf = StringIO() 84 outf = StringIO()
85 85
86 try: 86 try:
87 coverage_percent = self.cov.report(file=outf, omit=omit) 87 coverage_percent = self.cov.report(
88 file=outf, omit=omit, show_missing=True)
88 except coverage.CoverageException as ce: 89 except coverage.CoverageException as ce:
89 if ce.message != 'No data to report.': 90 if ce.message != 'No data to report.':
90 raise 91 raise
91 # If we have no data to report, this means that coverage has found no 92 # If we have no data to report, this means that coverage has found no
92 # tests in the module. Earlier version of coverage used to return 100 in 93 # tests in the module. Earlier version of coverage used to return 100 in
93 # this case, so we simulate it to keep backward compatibility. 94 # this case, so we simulate it to keep backward compatibility.
94 coverage_percent = 100.0 95 coverage_percent = 100.0
95 if verbose: 96 if verbose:
96 print 'No data to report, setting coverage to 100%' 97 print 'No data to report, setting coverage to 100%'
97 98
(...skipping 12 matching lines...) Expand all
110 print ('FATAL: Test coverage %.f%% is not the required %.f%% threshold' 111 print ('FATAL: Test coverage %.f%% is not the required %.f%% threshold'
111 % (int(coverage_percent), int(threshold))) 112 % (int(coverage_percent), int(threshold)))
112 113
113 return not fail 114 return not fail
114 115
115 def create_subprocess_context(self): 116 def create_subprocess_context(self):
116 # Can't have this method be the contextmanager because otherwise 117 # Can't have this method be the contextmanager because otherwise
117 # self (and self.cov) will get pickled to the subprocess, and we don't want 118 # self (and self.cov) will get pickled to the subprocess, and we don't want
118 # that :( 119 # that :(
119 return _Cover(self.enabled, self.opts) 120 return _Cover(self.enabled, self.opts)
OLDNEW
« 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