| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 import exceptions | 8 import exceptions |
| 9 import os | 9 import os |
| 10 import StringIO | 10 import StringIO |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 self.mox.ReplayAll() | 70 self.mox.ReplayAll() |
| 71 members = [ | 71 members = [ |
| 72 'AffectedFile', 'Change', 'DoPresubmitChecks', 'GitChange', | 72 'AffectedFile', 'Change', 'DoPresubmitChecks', 'GitChange', |
| 73 'GitAffectedFile', 'InputApi', | 73 'GitAffectedFile', 'InputApi', |
| 74 'ListRelevantPresubmitFiles', 'Main', 'NotImplementedException', | 74 'ListRelevantPresubmitFiles', 'Main', 'NotImplementedException', |
| 75 'OutputApi', 'ParseFiles', 'PresubmitExecuter', 'ScanSubDirs', | 75 'OutputApi', 'ParseFiles', 'PresubmitExecuter', 'ScanSubDirs', |
| 76 'SvnAffectedFile', 'SvnChange', | 76 'SvnAffectedFile', 'SvnChange', |
| 77 'cPickle', 'cStringIO', 'exceptions', | 77 'cPickle', 'cStringIO', 'exceptions', |
| 78 'fnmatch', 'gcl', 'gclient', 'glob', 'logging', 'marshal', 'normpath', | 78 'fnmatch', 'gcl', 'gclient', 'glob', 'logging', 'marshal', 'normpath', |
| 79 'optparse', 'os', 'pickle', | 79 'optparse', 'os', 'pickle', |
| 80 'presubmit_canned_checks', 'random', 're', 'subprocess', 'sys', | 80 'presubmit_canned_checks', 'random', 're', 'subprocess', 'sys', 'time', |
| 81 'tempfile', 'traceback', 'types', 'unittest', 'urllib2', 'warnings', | 81 'tempfile', 'traceback', 'types', 'unittest', 'urllib2', 'warnings', |
| 82 ] | 82 ] |
| 83 # If this test fails, you should add the relevant test. | 83 # If this test fails, you should add the relevant test. |
| 84 self.compareMembers(presubmit, members) | 84 self.compareMembers(presubmit, members) |
| 85 | 85 |
| 86 def testListRelevantPresubmitFiles(self): | 86 def testListRelevantPresubmitFiles(self): |
| 87 join = presubmit.os.path.join | 87 join = presubmit.os.path.join |
| 88 files = [ | 88 files = [ |
| 89 'blat.cc', | 89 'blat.cc', |
| 90 join('foo', 'haspresubmit', 'yodle', 'smart.h'), | 90 join('foo', 'haspresubmit', 'yodle', 'smart.h'), |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 process.communicate().AndReturn(('', '')) | 1407 process.communicate().AndReturn(('', '')) |
| 1408 self.mox.ReplayAll() | 1408 self.mox.ReplayAll() |
| 1409 | 1409 |
| 1410 results = presubmit_canned_checks.RunPythonUnitTests( | 1410 results = presubmit_canned_checks.RunPythonUnitTests( |
| 1411 input_api, presubmit.OutputApi, ['test_module']) | 1411 input_api, presubmit.OutputApi, ['test_module']) |
| 1412 self.assertEquals(len(results), 0) | 1412 self.assertEquals(len(results), 0) |
| 1413 | 1413 |
| 1414 | 1414 |
| 1415 if __name__ == '__main__': | 1415 if __name__ == '__main__': |
| 1416 unittest.main() | 1416 unittest.main() |
| OLD | NEW |