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

Side by Side Diff: tests/presubmit_unittest.py

Issue 562031: Fix licensing headers and move most third party code to third_party/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 years, 10 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 StringIO 8 import StringIO
9 9
10 # Fixes include path.
11 from super_mox import mox, SuperMoxTestBase
12
10 import presubmit_support as presubmit 13 import presubmit_support as presubmit
11 # Shortcut. 14 # Shortcut.
12 from presubmit_support import presubmit_canned_checks 15 presubmit_canned_checks = presubmit.presubmit_canned_checks
13 from super_mox import mox, SuperMoxTestBase
14 16
15 17
16 class PresubmitTestsBase(SuperMoxTestBase): 18 class PresubmitTestsBase(SuperMoxTestBase):
17 """Setups and tear downs the mocks but doesn't test anything as-is.""" 19 """Setups and tear downs the mocks but doesn't test anything as-is."""
18 presubmit_text = """ 20 presubmit_text = """
19 def CheckChangeOnUpload(input_api, output_api): 21 def CheckChangeOnUpload(input_api, output_api):
20 if not input_api.change.NOSUCHKEY: 22 if not input_api.change.NOSUCHKEY:
21 return [output_api.PresubmitError("!!")] 23 return [output_api.PresubmitError("!!")]
22 elif not input_api.change.REALLYNOSUCHKEY: 24 elif not input_api.change.REALLYNOSUCHKEY:
23 return [output_api.PresubmitPromptWarning("??")] 25 return [output_api.PresubmitPromptWarning("??")]
(...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 self.mox.ReplayAll() 1525 self.mox.ReplayAll()
1524 1526
1525 results = presubmit_canned_checks.RunPythonUnitTests( 1527 results = presubmit_canned_checks.RunPythonUnitTests(
1526 input_api, presubmit.OutputApi, ['test_module']) 1528 input_api, presubmit.OutputApi, ['test_module'])
1527 self.assertEquals(len(results), 0) 1529 self.assertEquals(len(results), 0)
1528 1530
1529 1531
1530 if __name__ == '__main__': 1532 if __name__ == '__main__':
1531 import unittest 1533 import unittest
1532 unittest.main() 1534 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698