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

Unified Diff: tests/presubmit_unittest.py

Issue 10199016: Add disabled_warnings arg to RunPylint() and use the default pylintrc file by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Add hashlib to the ignored symbols by pylint Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pylintrc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()
« no previous file with comments | « pylintrc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698