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

Side by Side Diff: tests/presubmit_unittest.py

Issue 1447463002: depot_tools: move some checks from commit to upload (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 1 month 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_canned_checks.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 """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 # pylint: disable=E1101,E1103 8 # pylint: disable=E1101,E1103
9 9
10 import StringIO 10 import StringIO
(...skipping 2878 matching lines...) Expand 10 before | Expand all | Expand 10 after
2889 (0, 'Hey!\n'), 2889 (0, 'Hey!\n'),
2890 (1, 'Ho!\n'), 2890 (1, 'Ho!\n'),
2891 (2, 'Hey!\n'), 2891 (2, 'Hey!\n'),
2892 (3, 'Ho!\n'), 2892 (3, 'Ho!\n'),
2893 (4, '\n')]) 2893 (4, '\n')])
2894 for _ in range(5): 2894 for _ in range(5):
2895 affected_file.LocalPath().AndReturn('hello.py') 2895 affected_file.LocalPath().AndReturn('hello.py')
2896 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file]) 2896 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file])
2897 input_api.ReadFile(affected_file).AndReturn('Hey!\nHo!\nHey!\nHo!\n\n') 2897 input_api.ReadFile(affected_file).AndReturn('Hey!\nHo!\nHey!\nHo!\n\n')
2898 2898
2899 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file])
2900
2901 input_api.AffectedSourceFiles(mox.IgnoreArg()).AndReturn([affected_file])
2902 input_api.ReadFile(affected_file, 'rb').AndReturn(
2903 'Hey!\nHo!\nHey!\nHo!\n\n')
2904 affected_file.LocalPath()
2905
2899 self.mox.ReplayAll() 2906 self.mox.ReplayAll()
2900 results = presubmit_canned_checks.PanProjectChecks( 2907 results = presubmit_canned_checks.PanProjectChecks(
2901 input_api, 2908 input_api,
2902 presubmit.OutputApi, 2909 presubmit.OutputApi,
2903 excluded_paths=None, 2910 excluded_paths=None,
2904 text_files=None, 2911 text_files=None,
2905 license_header=None, 2912 license_header=None,
2906 project_name=None, 2913 project_name=None,
2907 owners_check=False) 2914 owners_check=False)
2908 self.assertEqual(1, len(results)) 2915 self.assertEqual(2, len(results))
2909 self.assertEqual( 2916 self.assertEqual(
2910 'Found line ending with white spaces in:', results[0]._message) 2917 'Found line ending with white spaces in:', results[0]._message)
2911 self.checkstdout('') 2918 self.checkstdout('')
2912 2919
2913 2920
2914 if __name__ == '__main__': 2921 if __name__ == '__main__':
2915 import unittest 2922 import unittest
2916 unittest.main() 2923 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_canned_checks.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698