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

Side by Side Diff: PRESUBMIT_unittest.py

Issue 69019: REmove one unneeded seam. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 8 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 self.msg = msg 47 self.msg = msg
48 self.items = items 48 self.items = items
49 49
50 50
51 class PresubmitUnittest(unittest.TestCase): 51 class PresubmitUnittest(unittest.TestCase):
52 def setUp(self): 52 def setUp(self):
53 self.file_contents = '' 53 self.file_contents = ''
54 def MockReadFile(path): 54 def MockReadFile(path):
55 self.failIf(path.endswith('notsource')) 55 self.failIf(path.endswith('notsource'))
56 return self.file_contents 56 return self.file_contents
57 PRESUBMIT._ReadFile = MockReadFile 57 self._ReadFile = PRESUBMIT.ReadFile
58 PRESUBMIT.ReadFile = MockReadFile
58 59
59 def tearDown(self): 60 def tearDown(self):
60 PRESUBMIT._ReadFile = PRESUBMIT.ReadFile 61 PRESUBMIT.ReadFile = self._ReadFile
61 62
62 def testLocalChecks(self): 63 def testLocalChecks(self):
63 api = MockInputApi() 64 api = MockInputApi()
64 api.affected_files = [ 65 api.affected_files = [
65 MockAffectedFile('foo/blat/yoo.notsource'), 66 MockAffectedFile('foo/blat/yoo.notsource'),
66 MockAffectedFile('third_party/blat/source.cc'), 67 MockAffectedFile('third_party/blat/source.cc'),
67 MockAffectedFile('foo/blat/source.h'), 68 MockAffectedFile('foo/blat/source.h'),
68 MockAffectedFile('foo/blat/source.mm'), 69 MockAffectedFile('foo/blat/source.mm'),
69 MockAffectedFile('foo/blat/source.py'), 70 MockAffectedFile('foo/blat/source.py'),
70 ] 71 ]
(...skipping 22 matching lines...) Expand all
93 api = MockInputApi() 94 api = MockInputApi()
94 api.affected_files = [ 95 api.affected_files = [
95 MockAffectedFile('foo/blat/source.py', 'D'), 96 MockAffectedFile('foo/blat/source.py', 'D'),
96 ] 97 ]
97 self.file_contents = 'file with \n\terror\nhere\r\nyes there' 98 self.file_contents = 'file with \n\terror\nhere\r\nyes there'
98 self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 0) 99 self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 0)
99 100
100 101
101 if __name__ == '__main__': 102 if __name__ == '__main__':
102 unittest.main() 103 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