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

Side by Side Diff: PRESUBMIT_unittest.py

Issue 119201: Add the tree check there instead of implementing it in the root PRESUBMIT.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « PRESUBMIT.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) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 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 top-level Chromium presubmit script. 6 """Unit tests for top-level Chromium presubmit script.
7 """ 7 """
8 8
9 9
10 import os 10 import os
(...skipping 22 matching lines...) Expand all
33 def __init__(self, path, action='A'): 33 def __init__(self, path, action='A'):
34 self.path = path 34 self.path = path
35 self.action = action 35 self.action = action
36 36
37 def Action(self): 37 def Action(self):
38 return self.action 38 return self.action
39 39
40 def LocalPath(self): 40 def LocalPath(self):
41 return self.path 41 return self.path
42 42
43 def AbsoluteLocalPath(self):
44 return self.path
45
43 46
44 class MockOutputApi(object): 47 class MockOutputApi(object):
45 class PresubmitError(object): 48 class PresubmitError(object):
46 def __init__(self, msg, items=[], long_text=''): 49 def __init__(self, msg, items=[], long_text=''):
47 self.msg = msg 50 self.msg = msg
48 self.items = items 51 self.items = items
49 52
50 53
51 class PresubmitUnittest(unittest.TestCase): 54 class PresubmitUnittest(unittest.TestCase):
52 def setUp(self): 55 def setUp(self):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 api = MockInputApi() 97 api = MockInputApi()
95 api.affected_files = [ 98 api.affected_files = [
96 MockAffectedFile('foo/blat/source.py', 'D'), 99 MockAffectedFile('foo/blat/source.py', 'D'),
97 ] 100 ]
98 self.file_contents = 'file with \n\terror\nhere\r\nyes there' 101 self.file_contents = 'file with \n\terror\nhere\r\nyes there'
99 self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 0) 102 self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 0)
100 103
101 104
102 if __name__ == '__main__': 105 if __name__ == '__main__':
103 unittest.main() 106 unittest.main()
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698