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

Side by Side Diff: tests/presubmit_unittest.py

Issue 1116001: Add input_api.json to presubmit checks. (Closed)
Patch Set: Created 10 years, 9 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 unified diff | Download patch
« no previous file with comments | « presubmit_support.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 StringIO 8 import StringIO
9 9
10 # Fixes include path. 10 # Fixes include path.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 """General presubmit_support.py tests (excluding InputApi and OutputApi).""" 59 """General presubmit_support.py tests (excluding InputApi and OutputApi)."""
60 def testMembersChanged(self): 60 def testMembersChanged(self):
61 self.mox.ReplayAll() 61 self.mox.ReplayAll()
62 members = [ 62 members = [
63 'AffectedFile', 'Change', 'DoGetTrySlaves', 'DoPresubmitChecks', 63 'AffectedFile', 'Change', 'DoGetTrySlaves', 'DoPresubmitChecks',
64 'GetTrySlavesExecuter', 'GitAffectedFile', 'GitChange', 64 'GetTrySlavesExecuter', 'GitAffectedFile', 'GitChange',
65 'InputApi', 'ListRelevantPresubmitFiles', 'Main', 65 'InputApi', 'ListRelevantPresubmitFiles', 'Main',
66 'NotImplementedException', 'OutputApi', 'ParseFiles', 66 'NotImplementedException', 'OutputApi', 'ParseFiles',
67 'PresubmitExecuter', 'PromptYesNo', 'ScanSubDirs', 67 'PresubmitExecuter', 'PromptYesNo', 'ScanSubDirs',
68 'SvnAffectedFile', 'SvnChange', 'cPickle', 'cStringIO', 68 'SvnAffectedFile', 'SvnChange', 'cPickle', 'cStringIO',
69 'exceptions', 'fnmatch', 'gcl', 'gclient_utils', 'glob', 69 'exceptions', 'fnmatch', 'gcl', 'gclient_utils', 'glob', 'json',
70 'logging', 'marshal', 'normpath', 'optparse', 'os', 'pickle', 70 'logging', 'marshal', 'normpath', 'optparse', 'os', 'pickle',
71 'presubmit_canned_checks', 'random', 're', 'scm', 'subprocess', 'sys', 71 'presubmit_canned_checks', 'random', 're', 'scm', 'subprocess', 'sys',
72 'tempfile', 'time', 'traceback', 'types', 'unittest', 'urllib2', 72 'tempfile', 'time', 'traceback', 'types', 'unittest', 'urllib2',
73 'warnings', 73 'warnings',
74 ] 74 ]
75 # If this test fails, you should add the relevant test. 75 # If this test fails, you should add the relevant test.
76 self.compareMembers(presubmit, members) 76 self.compareMembers(presubmit, members)
77 77
78 def testListRelevantPresubmitFiles(self): 78 def testListRelevantPresubmitFiles(self):
79 join = presubmit.os.path.join 79 join = presubmit.os.path.join
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 def testMembersChanged(self): 553 def testMembersChanged(self):
554 self.mox.ReplayAll() 554 self.mox.ReplayAll()
555 members = [ 555 members = [
556 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles', 556 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles',
557 'AffectedTextFiles', 557 'AffectedTextFiles',
558 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST', 558 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST',
559 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths', 559 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths',
560 'LocalToDepotPath', 560 'LocalToDepotPath',
561 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths', 561 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths',
562 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ', 562 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ',
563 'is_committing', 'marshal', 'os_path', 'pickle', 'platform', 563 'is_committing', 'json', 'marshal', 'os_path', 'pickle', 'platform',
564 'python_executable', 564 'python_executable',
565 're', 'subprocess', 'tempfile', 'traceback', 'unittest', 'urllib2', 565 're', 'subprocess', 'tempfile', 'traceback', 'unittest', 'urllib2',
566 'version', 566 'version',
567 ] 567 ]
568 # If this test fails, you should add the relevant test. 568 # If this test fails, you should add the relevant test.
569 self.compareMembers(presubmit.InputApi(None, './.', False), members) 569 self.compareMembers(presubmit.InputApi(None, './.', False), members)
570 570
571 def testDepotToLocalPath(self): 571 def testDepotToLocalPath(self):
572 presubmit.scm.SVN.CaptureInfo('svn://foo/smurf').AndReturn( 572 presubmit.scm.SVN.CaptureInfo('svn://foo/smurf').AndReturn(
573 {'Path': 'prout'}) 573 {'Path': 'prout'})
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 self.mox.ReplayAll() 1525 self.mox.ReplayAll()
1526 1526
1527 results = presubmit_canned_checks.RunPythonUnitTests( 1527 results = presubmit_canned_checks.RunPythonUnitTests(
1528 input_api, presubmit.OutputApi, ['test_module']) 1528 input_api, presubmit.OutputApi, ['test_module'])
1529 self.assertEquals(len(results), 0) 1529 self.assertEquals(len(results), 0)
1530 1530
1531 1531
1532 if __name__ == '__main__': 1532 if __name__ == '__main__':
1533 import unittest 1533 import unittest
1534 unittest.main() 1534 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698