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

Side by Side Diff: tests/presubmit_unittest.py

Issue 115719: Add InputApi.version so the presubmit script can mark a minimum supported version for instance. (Closed)
Patch Set: Created 11 years, 7 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') | 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 os 8 import os
9 import StringIO 9 import StringIO
10 import sys 10 import sys
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 397
398 class InputApiUnittest(PresubmitTestsBase): 398 class InputApiUnittest(PresubmitTestsBase):
399 """Tests presubmit.InputApi.""" 399 """Tests presubmit.InputApi."""
400 def testMembersChanged(self): 400 def testMembersChanged(self):
401 members = [ 401 members = [
402 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedTextFiles', 402 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedTextFiles',
403 'DepotToLocalPath', 'FilterTextFiles', 'LocalPaths', 'LocalToDepotPath', 403 'DepotToLocalPath', 'FilterTextFiles', 'LocalPaths', 'LocalToDepotPath',
404 'PresubmitLocalPath', 'RightHandSideLines', 'ServerPaths', 404 'PresubmitLocalPath', 'RightHandSideLines', 'ServerPaths',
405 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 405 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change',
406 'marshal', 'os_path', 'pickle', 'platform', 406 'marshal', 'os_path', 'pickle', 'platform',
407 're', 'subprocess', 'tempfile', 'urllib2', 407 're', 'subprocess', 'tempfile', 'urllib2', 'version',
408 ] 408 ]
409 # If this test fails, you should add the relevant test. 409 # If this test fails, you should add the relevant test.
410 self.compareMembers(presubmit.InputApi(None, './.'), members) 410 self.compareMembers(presubmit.InputApi(None, './.'), members)
411 411
412 def testDepotToLocalPath(self): 412 def testDepotToLocalPath(self):
413 path = presubmit.InputApi.DepotToLocalPath('svn:/foo/smurf') 413 path = presubmit.InputApi.DepotToLocalPath('svn:/foo/smurf')
414 self.failUnless(path == 'smurf') 414 self.failUnless(path == 'smurf')
415 path = presubmit.InputApi.DepotToLocalPath('svn:/foo/notfound/burp') 415 path = presubmit.InputApi.DepotToLocalPath('svn:/foo/notfound/burp')
416 self.failUnless(path == None) 416 self.failUnless(path == None)
417 417
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 # TODO(maruel): Add real tests. 744 # TODO(maruel): Add real tests.
745 self.failIf(presubmit_canned_checks.RunPythonUnitTests( 745 self.failIf(presubmit_canned_checks.RunPythonUnitTests(
746 self.MockInputApi(), 746 self.MockInputApi(),
747 presubmit.OutputApi, [])) 747 presubmit.OutputApi, []))
748 self.failUnless(presubmit_canned_checks.RunPythonUnitTests( 748 self.failUnless(presubmit_canned_checks.RunPythonUnitTests(
749 self.MockInputApi(), 749 self.MockInputApi(),
750 presubmit.OutputApi, ['non_existent_module'])) 750 presubmit.OutputApi, ['non_existent_module']))
751 751
752 if __name__ == '__main__': 752 if __name__ == '__main__':
753 unittest.main() 753 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698