| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" | 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" |
| 7 | 7 |
| 8 # pylint: disable=E1101,E1103 | 8 # pylint: disable=E1101,E1103 |
| 9 | 9 |
| 10 import logging | 10 import logging |
| (...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2170 child.communicate() | 2170 child.communicate() |
| 2171 child.returncode = 0 | 2171 child.returncode = 0 |
| 2172 | 2172 |
| 2173 input_api.subprocess.Popen(['pyyyyython', pylint, '--args-on-stdin'], | 2173 input_api.subprocess.Popen(['pyyyyython', pylint, '--args-on-stdin'], |
| 2174 env=mox.IgnoreArg(), stdin=subprocess.PIPE).AndReturn(child) | 2174 env=mox.IgnoreArg(), stdin=subprocess.PIPE).AndReturn(child) |
| 2175 self.mox.ReplayAll() | 2175 self.mox.ReplayAll() |
| 2176 | 2176 |
| 2177 results = presubmit_canned_checks.RunPylint( | 2177 results = presubmit_canned_checks.RunPylint( |
| 2178 input_api, presubmit.OutputApi) | 2178 input_api, presubmit.OutputApi) |
| 2179 self.assertEquals([], results) | 2179 self.assertEquals([], results) |
| 2180 self.checkstdout('Running pylint on 1 files.\n') |
| 2180 | 2181 |
| 2181 def testCheckBuildbotPendingBuildsBad(self): | 2182 def testCheckBuildbotPendingBuildsBad(self): |
| 2182 input_api = self.MockInputApi(None, True) | 2183 input_api = self.MockInputApi(None, True) |
| 2183 connection = self.mox.CreateMockAnything() | 2184 connection = self.mox.CreateMockAnything() |
| 2184 input_api.urllib2.urlopen('uurl').AndReturn(connection) | 2185 input_api.urllib2.urlopen('uurl').AndReturn(connection) |
| 2185 connection.read().AndReturn('foo') | 2186 connection.read().AndReturn('foo') |
| 2186 connection.close() | 2187 connection.close() |
| 2187 self.mox.ReplayAll() | 2188 self.mox.ReplayAll() |
| 2188 | 2189 |
| 2189 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( | 2190 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2485 owners_check=False) | 2486 owners_check=False) |
| 2486 self.assertEqual(1, len(results)) | 2487 self.assertEqual(1, len(results)) |
| 2487 self.assertEqual( | 2488 self.assertEqual( |
| 2488 'Found line ending with white spaces in:', results[0]._message) | 2489 'Found line ending with white spaces in:', results[0]._message) |
| 2489 self.checkstdout('') | 2490 self.checkstdout('') |
| 2490 | 2491 |
| 2491 | 2492 |
| 2492 if __name__ == '__main__': | 2493 if __name__ == '__main__': |
| 2493 import unittest | 2494 import unittest |
| 2494 unittest.main() | 2495 unittest.main() |
| OLD | NEW |