Commit 0d1bdead authored by dpranke@chromium.org's avatar dpranke@chromium.org

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
parent 56e48bcb
......@@ -4,8 +4,6 @@
"""Generic presubmit checks that can be reused by other presubmit checks."""
import time
### Description checks
......@@ -761,7 +759,7 @@ def PanProjectChecks(input_api, output_api,
r'can be\n'
r'.*? found in the LICENSE file\.\n'
) % {
'year': time.strftime('%Y'),
'year': input_api.time.strftime('%Y'),
'project': project_name,
}
......
......@@ -257,6 +257,7 @@ class InputApi(object):
self.re = re
self.subprocess = subprocess
self.tempfile = tempfile
self.time = time
self.traceback = traceback
self.unittest = unittest
self.urllib2 = urllib2
......
......@@ -721,8 +721,8 @@ class InputApiUnittest(PresubmitTestsBase):
'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ',
'host_url', 'is_committing', 'json', 'marshal', 'os_path',
'owners_db', 'pickle', 'platform', 'python_executable', 're',
'subprocess', 'tbr', 'tempfile', 'traceback', 'unittest', 'urllib2',
'version',
'subprocess', 'tbr', 'tempfile', 'time', 'traceback', 'unittest',
'urllib2', 'version',
]
# If this test fails, you should add the relevant test.
self.compareMembers(presubmit.InputApi(self.fake_change, './.', False,
......@@ -1247,6 +1247,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
def testMembersChanged(self):
self.mox.ReplayAll()
members = [
'CheckBuildbotPendingBuilds',
'CheckChangeHasBugField', 'CheckChangeHasDescription',
'CheckChangeHasNoStrayWhitespace',
'CheckChangeHasOnlyOneEol', 'CheckChangeHasNoCR',
......@@ -1256,15 +1257,15 @@ class CannedChecksUnittest(PresubmitTestsBase):
'CheckChangeHasTestField',
'CheckChangeLintsClean',
'CheckChangeSvnEolStyle',
'CheckLicense',
'CheckSvnModifiedDirectories',
'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
'CheckDoNotSubmit',
'CheckDoNotSubmitInDescription', 'CheckDoNotSubmitInFiles',
'CheckLongLines', 'CheckTreeIsOpen', 'RunPythonUnitTests',
'RunPylint',
'CheckBuildbotPendingBuilds', 'CheckRietveldTryJobExecution',
'CheckLongLines', 'CheckTreeIsOpen', 'PanProjectChecks',
'CheckLicense',
'CheckOwners',
'CheckRietveldTryJobExecution',
'CheckSvnModifiedDirectories',
'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
'RunPythonUnitTests', 'RunPylint',
]
# If this test fails, you should add the relevant test.
self.compareMembers(presubmit_canned_checks, members)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment