fix a few minor lint and test issues. Note that presubmit_canned_checks

should never import any modules directly but always access modules
through input_api.

Review URL: http://codereview.chromium.org/6676128

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@79337 0039d316-1c4b-4281-b951-d872f2087c98
experimental/szager/collated-output
dpranke@chromium.org 14 years ago
parent 56e48bcb48
commit 0d1bdeadb7

@ -4,8 +4,6 @@
"""Generic presubmit checks that can be reused by other presubmit checks.""" """Generic presubmit checks that can be reused by other presubmit checks."""
import time
### Description checks ### Description checks
@ -761,7 +759,7 @@ def PanProjectChecks(input_api, output_api,
r'can be\n' r'can be\n'
r'.*? found in the LICENSE file\.\n' r'.*? found in the LICENSE file\.\n'
) % { ) % {
'year': time.strftime('%Y'), 'year': input_api.time.strftime('%Y'),
'project': project_name, 'project': project_name,
} }

@ -257,6 +257,7 @@ class InputApi(object):
self.re = re self.re = re
self.subprocess = subprocess self.subprocess = subprocess
self.tempfile = tempfile self.tempfile = tempfile
self.time = time
self.traceback = traceback self.traceback = traceback
self.unittest = unittest self.unittest = unittest
self.urllib2 = urllib2 self.urllib2 = urllib2

@ -721,8 +721,8 @@ class InputApiUnittest(PresubmitTestsBase):
'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ', 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ',
'host_url', 'is_committing', 'json', 'marshal', 'os_path', 'host_url', 'is_committing', 'json', 'marshal', 'os_path',
'owners_db', 'pickle', 'platform', 'python_executable', 're', 'owners_db', 'pickle', 'platform', 'python_executable', 're',
'subprocess', 'tbr', 'tempfile', 'traceback', 'unittest', 'urllib2', 'subprocess', 'tbr', 'tempfile', 'time', 'traceback', 'unittest',
'version', 'urllib2', 'version',
] ]
# If this test fails, you should add the relevant test. # If this test fails, you should add the relevant test.
self.compareMembers(presubmit.InputApi(self.fake_change, './.', False, self.compareMembers(presubmit.InputApi(self.fake_change, './.', False,
@ -1247,6 +1247,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testMembersChanged(self): def testMembersChanged(self):
self.mox.ReplayAll() self.mox.ReplayAll()
members = [ members = [
'CheckBuildbotPendingBuilds',
'CheckChangeHasBugField', 'CheckChangeHasDescription', 'CheckChangeHasBugField', 'CheckChangeHasDescription',
'CheckChangeHasNoStrayWhitespace', 'CheckChangeHasNoStrayWhitespace',
'CheckChangeHasOnlyOneEol', 'CheckChangeHasNoCR', 'CheckChangeHasOnlyOneEol', 'CheckChangeHasNoCR',
@ -1256,15 +1257,15 @@ class CannedChecksUnittest(PresubmitTestsBase):
'CheckChangeHasTestField', 'CheckChangeHasTestField',
'CheckChangeLintsClean', 'CheckChangeLintsClean',
'CheckChangeSvnEolStyle', 'CheckChangeSvnEolStyle',
'CheckLicense',
'CheckSvnModifiedDirectories',
'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
'CheckDoNotSubmit', 'CheckDoNotSubmit',
'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles', 'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles',
'CheckLongLines', 'CheckTreeIsOpen', 'RunPythonUnitTests', 'CheckLongLines', 'CheckTreeIsOpen', 'PanProjectChecks',
'RunPylint', 'CheckLicense',
'CheckBuildbotPendingBuilds', 'CheckRietveldTryJobExecution',
'CheckOwners', 'CheckOwners',
'CheckRietveldTryJobExecution',
'CheckSvnModifiedDirectories',
'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
'RunPythonUnitTests', 'RunPylint',
] ]
# If this test fails, you should add the relevant test. # If this test fails, you should add the relevant test.
self.compareMembers(presubmit_canned_checks, members) self.compareMembers(presubmit_canned_checks, members)

Loading…
Cancel
Save