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

Side by Side Diff: presubmit_canned_checks.py

Issue 113883: Remove SPECIAL_KEYS and GclChange.Changelist() to simplify the code. (Closed)
Patch Set: Created 11 years, 6 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 | presubmit_support.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generic presubmit checks that can be reused by other presubmit checks.""" 6 """Generic presubmit checks that can be reused by other presubmit checks."""
7 7
8 8
9 def CheckChangeHasTestField(input_api, output_api): 9 def CheckChangeHasTestField(input_api, output_api):
10 """Requires that the changelist have a TEST= field.""" 10 """Requires that the changelist have a TEST= field."""
11 if input_api.change.Test: 11 if input_api.change.TEST:
12 return [] 12 return []
13 else: 13 else:
14 return [output_api.PresubmitNotifyResult( 14 return [output_api.PresubmitNotifyResult(
15 "Changelist should have a TEST= field. TEST=none is allowed.")] 15 "Changelist should have a TEST= field. TEST=none is allowed.")]
16 16
17 17
18 def CheckChangeHasBugField(input_api, output_api): 18 def CheckChangeHasBugField(input_api, output_api):
19 """Requires that the changelist have a BUG= field.""" 19 """Requires that the changelist have a BUG= field."""
20 if input_api.change.BugIDs: 20 if input_api.change.BUG:
21 return [] 21 return []
22 else: 22 else:
23 return [output_api.PresubmitNotifyResult( 23 return [output_api.PresubmitNotifyResult(
24 "Changelist should have a BUG= field. BUG=none is allowed.")] 24 "Changelist should have a BUG= field. BUG=none is allowed.")]
25 25
26 26
27 def CheckChangeHasTestedField(input_api, output_api): 27 def CheckChangeHasTestedField(input_api, output_api):
28 """Requires that the changelist have a TESTED= field.""" 28 """Requires that the changelist have a TESTED= field."""
29 if input_api.change.Tested: 29 if input_api.change.TESTED:
30 return [] 30 return []
31 else: 31 else:
32 return [output_api.PresubmitError("Changelist must have a TESTED= field.")] 32 return [output_api.PresubmitError("Changelist must have a TESTED= field.")]
33 33
34 34
35 def CheckChangeHasQaField(input_api, output_api): 35 def CheckChangeHasQaField(input_api, output_api):
36 """Requires that the changelist have a QA= field.""" 36 """Requires that the changelist have a QA= field."""
37 if input_api.change.QA: 37 if input_api.change.QA:
38 return [] 38 return []
39 else: 39 else:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 except ImportError: 138 except ImportError:
139 outputs.Append(output_api.PresubmitError("Failed to load %s" % unit_test)) 139 outputs.Append(output_api.PresubmitError("Failed to load %s" % unit_test))
140 raise 140 raise
141 141
142 results = unittest.TextTestRunner(verbosity=0).run(unittest.TestSuite( 142 results = unittest.TextTestRunner(verbosity=0).run(unittest.TestSuite(
143 tests_suite)) 143 tests_suite))
144 if not results.wasSuccessful(): 144 if not results.wasSuccessful():
145 outputs.append(output_api.PresubmitError( 145 outputs.append(output_api.PresubmitError(
146 "%d unit tests failed." % (results.failures + results.errors))) 146 "%d unit tests failed." % (results.failures + results.errors)))
147 return outputs 147 return outputs
OLDNEW
« no previous file with comments | « no previous file | presubmit_support.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698