diff --git a/presubmit_canned_checks.py b/presubmit_canned_checks.py index 25a346021..5b54a5b9a 100644 --- a/presubmit_canned_checks.py +++ b/presubmit_canned_checks.py @@ -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, } diff --git a/presubmit_support.py b/presubmit_support.py index f56ddd8ae..e15b634f8 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -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 diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index c7ad8191d..1ecadb9c1 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -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)