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

Side by Side Diff: depot_tools/tests/presubmit_unittest.py

Issue 268023: This makes presubmit queries accept "yes" as well as "y" (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/
Patch Set: '' Created 11 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « depot_tools/presubmit_support.py ('k') | no next file » | 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) 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 self.mox.StubOutWithMock(presubmit.gcl, 'GetSVNFileProperty') 71 self.mox.StubOutWithMock(presubmit.gcl, 'GetSVNFileProperty')
72 self.mox.StubOutWithMock(presubmit.gcl, 'ReadFile') 72 self.mox.StubOutWithMock(presubmit.gcl, 'ReadFile')
73 73
74 74
75 class PresubmitUnittest(PresubmitTestsBase): 75 class PresubmitUnittest(PresubmitTestsBase):
76 """General presubmit_support.py tests (excluding InputApi and OutputApi).""" 76 """General presubmit_support.py tests (excluding InputApi and OutputApi)."""
77 def testMembersChanged(self): 77 def testMembersChanged(self):
78 self.mox.ReplayAll() 78 self.mox.ReplayAll()
79 members = [ 79 members = [
80 'AffectedFile', 'Change', 'DoGetTrySlaves', 'DoPresubmitChecks', 80 'AffectedFile', 'Change', 'DoGetTrySlaves', 'DoPresubmitChecks',
81 'GetTrySlavesExecuter', 'GitChange', 'GitAffectedFile', 'InputApi', 81 'GetTrySlavesExecuter', 'GitAffectedFile', 'GitChange',
82 'ListRelevantPresubmitFiles', 'Main', 'NotImplementedException', 82 'InputApi', 'ListRelevantPresubmitFiles', 'Main',
83 'OutputApi', 'ParseFiles', 'PresubmitExecuter', 'ScanSubDirs', 83 'NotImplementedException', 'OutputApi', 'ParseFiles',
84 'SvnAffectedFile', 'SvnChange', 84 'PresubmitExecuter', 'PromptYesNo', 'ScanSubDirs',
85 'cPickle', 'cStringIO', 'exceptions', 85 'SvnAffectedFile', 'SvnChange', 'cPickle', 'cStringIO',
86 'fnmatch', 'gcl', 'gclient_scm', 'glob', 'logging', 'marshal', 'normpath', 86 'exceptions', 'fnmatch', 'gcl', 'gclient_scm', 'glob',
87 'optparse', 'os', 'pickle', 87 'logging', 'marshal', 'normpath', 'optparse', 'os', 'pickle',
88 'presubmit_canned_checks', 'random', 're', 'subprocess', 'sys', 'time', 88 'presubmit_canned_checks', 'random', 're', 'subprocess', 'sys',
89 'tempfile', 'traceback', 'types', 'unittest', 'urllib2', 'warnings', 89 'tempfile', 'time', 'traceback', 'types', 'unittest', 'urllib2',
90 'warnings',
90 ] 91 ]
91 # If this test fails, you should add the relevant test. 92 # If this test fails, you should add the relevant test.
92 self.compareMembers(presubmit, members) 93 self.compareMembers(presubmit, members)
93 94
94 def testListRelevantPresubmitFiles(self): 95 def testListRelevantPresubmitFiles(self):
95 join = presubmit.os.path.join 96 join = presubmit.os.path.join
96 files = [ 97 files = [
97 'blat.cc', 98 'blat.cc',
98 join('foo', 'haspresubmit', 'yodle', 'smart.h'), 99 join('foo', 'haspresubmit', 'yodle', 'smart.h'),
99 join('moo', 'mat', 'gat', 'yo.h'), 100 join('moo', 'mat', 'gat', 'yo.h'),
(...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 process.communicate().AndReturn(('', '')) 1471 process.communicate().AndReturn(('', ''))
1471 self.mox.ReplayAll() 1472 self.mox.ReplayAll()
1472 1473
1473 results = presubmit_canned_checks.RunPythonUnitTests( 1474 results = presubmit_canned_checks.RunPythonUnitTests(
1474 input_api, presubmit.OutputApi, ['test_module']) 1475 input_api, presubmit.OutputApi, ['test_module'])
1475 self.assertEquals(len(results), 0) 1476 self.assertEquals(len(results), 0)
1476 1477
1477 1478
1478 if __name__ == '__main__': 1479 if __name__ == '__main__':
1479 unittest.main() 1480 unittest.main()
OLDNEW
« no previous file with comments | « depot_tools/presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698