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

Side by Side Diff: PRESUBMIT_test.py

Issue 11830057: Don't issue try jobs for OWNERS-only changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« PRESUBMIT.py ('K') | « 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 import os 6 import os
7 import re 7 import re
8 import unittest 8 import unittest
9 9
10 import PRESUBMIT 10 import PRESUBMIT
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 def ChangedContents(self): 53 def ChangedContents(self):
54 return self._changed_contents 54 return self._changed_contents
55 55
56 def NewContents(self): 56 def NewContents(self):
57 return self._new_contents 57 return self._new_contents
58 58
59 def LocalPath(self): 59 def LocalPath(self):
60 return self._local_path 60 return self._local_path
61 61
62 62
63 class MockChange(object):
64 def __init__(self, changed_files):
65 self._changed_files = changed_files
66
67 def LocalPaths(self):
68 return self._changed_files
69
70
63 class IncludeOrderTest(unittest.TestCase): 71 class IncludeOrderTest(unittest.TestCase):
64 def testSystemHeaderOrder(self): 72 def testSystemHeaderOrder(self):
65 scope = [(1, '#include <csystem.h>'), 73 scope = [(1, '#include <csystem.h>'),
66 (2, '#include <cppsystem>'), 74 (2, '#include <cppsystem>'),
67 (3, '#include "acustom.h"')] 75 (3, '#include "acustom.h"')]
68 all_linenums = [linenum for (linenum, _) in scope] 76 all_linenums = [linenum for (linenum, _) in scope]
69 mock_input_api = MockInputApi() 77 mock_input_api = MockInputApi()
70 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api, 78 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
71 '', all_linenums) 79 '', all_linenums)
72 self.assertEqual(0, len(warnings)) 80 self.assertEqual(0, len(warnings))
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 340
333 def testGoodFiles(self): 341 def testGoodFiles(self):
334 mock_input_api = MockInputApi() 342 mock_input_api = MockInputApi()
335 mock_input_api.files = [ 343 mock_input_api.files = [
336 MockFile('other/path/qux.h', ''), 344 MockFile('other/path/qux.h', ''),
337 MockFile('other/path/qux.cc', ''), 345 MockFile('other/path/qux.cc', ''),
338 ] 346 ]
339 results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi()) 347 results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi())
340 self.assertEqual(0, len(results)) 348 self.assertEqual(0, len(results))
341 349
350 def testOnlyOwnersFiles(self):
351 mock_change = MockChange([
352 'some/path/OWNERS',
353 'A\Windows\Path\OWNERS',
354 ])
355 results = PRESUBMIT.GetPreferredTrySlaves(None, mock_change)
356 self.assertEqual(0, len(results))
357
342 358
343 if __name__ == '__main__': 359 if __name__ == '__main__':
344 unittest.main() 360 unittest.main()
OLDNEW
« PRESUBMIT.py ('K') | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698