| 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 StringIO | 10 import StringIO |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 'GitChange', 'InputApi', 'ListRelevantPresubmitFiles', 'main', | 176 'GitChange', 'InputApi', 'ListRelevantPresubmitFiles', 'main', |
| 177 'NonexistantCannedCheckFilter', 'OutputApi', 'ParseFiles', | 177 'NonexistantCannedCheckFilter', 'OutputApi', 'ParseFiles', |
| 178 'PresubmitFailure', 'PresubmitExecuter', 'PresubmitOutput', 'ScanSubDirs', | 178 'PresubmitFailure', 'PresubmitExecuter', 'PresubmitOutput', 'ScanSubDirs', |
| 179 'SvnAffectedFile', 'SvnChange', 'auth', 'cPickle', 'cpplint', 'cStringIO', | 179 'SvnAffectedFile', 'SvnChange', 'auth', 'cPickle', 'cpplint', 'cStringIO', |
| 180 'contextlib', 'canned_check_filter', 'fix_encoding', 'fnmatch', | 180 'contextlib', 'canned_check_filter', 'fix_encoding', 'fnmatch', |
| 181 'gclient_utils', 'glob', 'inspect', 'json', 'load_files', 'logging', | 181 'gclient_utils', 'glob', 'inspect', 'json', 'load_files', 'logging', |
| 182 'marshal', 'normpath', 'optparse', 'os', 'owners', 'pickle', | 182 'marshal', 'normpath', 'optparse', 'os', 'owners', 'pickle', |
| 183 'presubmit_canned_checks', 'random', 're', 'rietveld', 'scm', | 183 'presubmit_canned_checks', 'random', 're', 'rietveld', 'scm', |
| 184 'subprocess', 'sys', 'tempfile', 'time', 'traceback', 'types', 'unittest', | 184 'subprocess', 'sys', 'tempfile', 'time', 'traceback', 'types', 'unittest', |
| 185 'urllib2', 'warn', 'multiprocessing', 'DoGetTryMasters', | 185 'urllib2', 'warn', 'multiprocessing', 'DoGetTryMasters', |
| 186 'GetTryMastersExecuter', 'itertools', | 186 'GetTryMastersExecuter', 'itertools', 'urlparse', 'gerrit_util', |
| 187 ] | 187 ] |
| 188 # If this test fails, you should add the relevant test. | 188 # If this test fails, you should add the relevant test. |
| 189 self.compareMembers(presubmit, members) | 189 self.compareMembers(presubmit, members) |
| 190 | 190 |
| 191 def testCannedCheckFilter(self): | 191 def testCannedCheckFilter(self): |
| 192 canned = presubmit.presubmit_canned_checks | 192 canned = presubmit.presubmit_canned_checks |
| 193 orig = canned.CheckOwners | 193 orig = canned.CheckOwners |
| 194 with presubmit.canned_check_filter(['CheckOwners']): | 194 with presubmit.canned_check_filter(['CheckOwners']): |
| 195 self.assertNotEqual(canned.CheckOwners, orig) | 195 self.assertNotEqual(canned.CheckOwners, orig) |
| 196 self.assertEqual(canned.CheckOwners(None, None), []) | 196 self.assertEqual(canned.CheckOwners(None, None), []) |
| (...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 owners_check=False) | 2888 owners_check=False) |
| 2889 self.assertEqual(2, len(results)) | 2889 self.assertEqual(2, len(results)) |
| 2890 self.assertEqual( | 2890 self.assertEqual( |
| 2891 'Found line ending with white spaces in:', results[0]._message) | 2891 'Found line ending with white spaces in:', results[0]._message) |
| 2892 self.checkstdout('') | 2892 self.checkstdout('') |
| 2893 | 2893 |
| 2894 | 2894 |
| 2895 if __name__ == '__main__': | 2895 if __name__ == '__main__': |
| 2896 import unittest | 2896 import unittest |
| 2897 unittest.main() | 2897 unittest.main() |
| OLD | NEW |