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

Side by Side Diff: tests/presubmit_unittest.py

Issue 1181103002: Parallelize pylint PRESUBMIT checks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 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
« presubmit_canned_checks.py ('K') | « presubmit_support.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 functools 10 import functools
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1176 except SystemExit, e: 1176 except SystemExit, e:
1177 self.assertEquals(2, e.code) 1177 self.assertEquals(2, e.code)
1178 1178
1179 1179
1180 class InputApiUnittest(PresubmitTestsBase): 1180 class InputApiUnittest(PresubmitTestsBase):
1181 """Tests presubmit.InputApi.""" 1181 """Tests presubmit.InputApi."""
1182 def testMembersChanged(self): 1182 def testMembersChanged(self):
1183 self.mox.ReplayAll() 1183 self.mox.ReplayAll()
1184 members = [ 1184 members = [
1185 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles', 1185 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles',
1186 'AffectedTextFiles', 1186 'AffectedTextFiles', 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST',
1187 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST', 1187 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths', 'LocalToDepotPath',
1188 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths', 1188 'Command', 'RunTests', 'PresubmitLocalPath', 'ReadFile',
1189 'LocalToDepotPath', 'Command', 'RunTests', 1189 'RightHandSideLines', 'ServerPaths', 'basename', 'cPickle', 'cpplint',
1190 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths', 1190 'cStringIO', 'canned_checks', 'change', 'cpu_count', 'environ', 'glob',
1191 'basename', 'cPickle', 'cpplint', 'cStringIO', 'canned_checks', 'change', 1191 'host_url', 'is_committing', 'json', 'logging', 'marshal', 'os_listdir',
1192 'environ', 'glob', 'host_url', 'is_committing', 'json', 'logging', 1192 'os_walk', 'os_path', 'os_stat', 'owners_db', 'pickle', 'platform',
1193 'marshal', 'os_listdir', 'os_walk', 'os_path', 'os_stat', 'owners_db', 1193 'python_executable', 're', 'rietveld', 'subprocess', 'tbr', 'tempfile',
1194 'pickle', 'platform', 'python_executable', 're', 'rietveld', 'subprocess', 1194 'time', 'traceback', 'unittest', 'urllib2', 'version', 'verbose',
1195 'tbr', 'tempfile', 'time', 'traceback', 'unittest', 'urllib2', 'version',
1196 'verbose',
1197 ] 1195 ]
1198 # If this test fails, you should add the relevant test. 1196 # If this test fails, you should add the relevant test.
1199 self.compareMembers( 1197 self.compareMembers(
1200 presubmit.InputApi(self.fake_change, './.', False, None, False), 1198 presubmit.InputApi(self.fake_change, './.', False, None, False),
1201 members) 1199 members)
1202 1200
1203 def testDepotToLocalPath(self): 1201 def testDepotToLocalPath(self):
1204 presubmit.scm.SVN._CaptureInfo(['svn://foo/smurf'], self.fake_root_dir 1202 presubmit.scm.SVN._CaptureInfo(['svn://foo/smurf'], self.fake_root_dir
1205 ).AndReturn({'Path': 'prout'}) 1203 ).AndReturn({'Path': 'prout'})
1206 presubmit.scm.SVN._CaptureInfo( 1204 presubmit.scm.SVN._CaptureInfo(
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1845 return 'foo' 1843 return 'foo'
1846 input_api.subprocess.CalledProcessError = fake_CalledProcessError 1844 input_api.subprocess.CalledProcessError = fake_CalledProcessError
1847 input_api.verbose = False 1845 input_api.verbose = False
1848 1846
1849 input_api.change = change 1847 input_api.change = change
1850 input_api.host_url = 'http://localhost' 1848 input_api.host_url = 'http://localhost'
1851 input_api.is_committing = committing 1849 input_api.is_committing = committing
1852 input_api.tbr = False 1850 input_api.tbr = False
1853 input_api.python_executable = 'pyyyyython' 1851 input_api.python_executable = 'pyyyyython'
1854 input_api.platform = sys.platform 1852 input_api.platform = sys.platform
1853 input_api.cpu_count = 2
1855 input_api.time = time 1854 input_api.time = time
1856 input_api.canned_checks = presubmit_canned_checks 1855 input_api.canned_checks = presubmit_canned_checks
1857 input_api.Command = presubmit.CommandData 1856 input_api.Command = presubmit.CommandData
1858 input_api.RunTests = functools.partial( 1857 input_api.RunTests = functools.partial(
1859 presubmit.InputApi.RunTests, input_api) 1858 presubmit.InputApi.RunTests, input_api)
1860 return input_api 1859 return input_api
1861 1860
1862 def testMembersChanged(self): 1861 def testMembersChanged(self):
1863 self.mox.ReplayAll() 1862 self.mox.ReplayAll()
1864 members = [ 1863 members = [
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 owners_check=False) 2889 owners_check=False)
2891 self.assertEqual(1, len(results)) 2890 self.assertEqual(1, len(results))
2892 self.assertEqual( 2891 self.assertEqual(
2893 'Found line ending with white spaces in:', results[0]._message) 2892 'Found line ending with white spaces in:', results[0]._message)
2894 self.checkstdout('') 2893 self.checkstdout('')
2895 2894
2896 2895
2897 if __name__ == '__main__': 2896 if __name__ == '__main__':
2898 import unittest 2897 import unittest
2899 unittest.main() 2898 unittest.main()
OLDNEW
« presubmit_canned_checks.py ('K') | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698