| Index: tests/presubmit_unittest.py
|
| diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py
|
| index 29f9a931007a3846d9fbb61991a0525f07b3db34..75d140ada80207cfd63a2de4f54ccc2b73211391 100755
|
| --- a/tests/presubmit_unittest.py
|
| +++ b/tests/presubmit_unittest.py
|
| @@ -13,6 +13,9 @@ import StringIO
|
| import sys
|
| import time
|
|
|
| +# TODO(maruel): Include inside depot_tools.
|
| +from pylint import lint
|
| +
|
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
| from testing_support.super_mox import mox, SuperMoxTestBase
|
| @@ -1449,6 +1452,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| input_api = self.mox.CreateMock(presubmit.InputApi)
|
| input_api.cStringIO = presubmit.cStringIO
|
| input_api.json = presubmit.json
|
| + input_api.logging = logging
|
| input_api.os_listdir = self.mox.CreateMockAnything()
|
| input_api.os_walk = self.mox.CreateMockAnything()
|
| input_api.os_path = presubmit.os.path
|
| @@ -1462,6 +1466,7 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| def __str__(self):
|
| return 'foo'
|
| input_api.subprocess.CalledProcessError = fake_CalledProcessError
|
| + input_api.verbose = False
|
|
|
| input_api.change = change
|
| input_api.host_url = 'http://localhost'
|
| @@ -2130,6 +2135,20 @@ class CannedChecksUnittest(PresubmitTestsBase):
|
| input_api, presubmit.OutputApi, ['test_module'])
|
| self.assertEquals(len(results), 0)
|
|
|
| + def testCannedRunPylint(self):
|
| + # lint.Run() always calls sys.exit()...
|
| + lint.Run = lambda x: sys.exit(0)
|
| + input_api = self.MockInputApi(None, True)
|
| + input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn(True)
|
| + input_api.PresubmitLocalPath().AndReturn('/foo')
|
| + input_api.PresubmitLocalPath().AndReturn('/foo')
|
| + input_api.os_walk('/foo').AndReturn([('/foo', [], ['file1.py'])])
|
| + self.mox.ReplayAll()
|
| +
|
| + results = presubmit_canned_checks.RunPylint(
|
| + input_api, presubmit.OutputApi)
|
| + self.assertEquals([], results)
|
| +
|
| def testCheckBuildbotPendingBuildsBad(self):
|
| input_api = self.MockInputApi(None, True)
|
| connection = self.mox.CreateMockAnything()
|
|
|