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

Side by Side Diff: tests/presubmit_unittest.py

Issue 281013002: Recursively find all tests in a repo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: instantiate exception Created 6 years, 7 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_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 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1766 self.mox.ReplayAll() 1766 self.mox.ReplayAll()
1767 1767
1768 output = filter(lambda x: x.IsTextFile(), files) 1768 output = filter(lambda x: x.IsTextFile(), files)
1769 self.assertEquals(1, len(output)) 1769 self.assertEquals(1, len(output))
1770 self.assertEquals(files[0], output[0]) 1770 self.assertEquals(files[0], output[0])
1771 1771
1772 1772
1773 class ChangeUnittest(PresubmitTestsBase): 1773 class ChangeUnittest(PresubmitTestsBase):
1774 def testMembersChanged(self): 1774 def testMembersChanged(self):
1775 members = [ 1775 members = [
1776 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedTextFiles', 1776 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedTextFiles', 'AllFiles',
1777 'DescriptionText', 'FullDescriptionText', 'LocalPaths', 'Name', 1777 'DescriptionText', 'FullDescriptionText', 'LocalPaths', 'Name',
1778 'RepositoryRoot', 'RightHandSideLines', 'ServerPaths', 1778 'RepositoryRoot', 'RightHandSideLines', 'ServerPaths',
1779 'SetDescriptionText', 'TAG_LINE_RE', 1779 'SetDescriptionText', 'TAG_LINE_RE',
1780 'author_email', 'issue', 'patchset', 'scm', 'tags', 1780 'author_email', 'issue', 'patchset', 'scm', 'tags',
1781 ] 1781 ]
1782 # If this test fails, you should add the relevant test. 1782 # If this test fails, you should add the relevant test.
1783 self.mox.ReplayAll() 1783 self.mox.ReplayAll()
1784 1784
1785 change = presubmit.Change( 1785 change = presubmit.Change(
1786 'foo', 'foo', self.fake_root_dir, [('M', 'AA')], 0, 0, 'foo') 1786 'foo', 'foo', self.fake_root_dir, [('M', 'AA')], 0, 0, 'foo')
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 'CheckLicense', 1878 'CheckLicense',
1879 'CheckOwners', 1879 'CheckOwners',
1880 'CheckPatchFormatted', 1880 'CheckPatchFormatted',
1881 'CheckRietveldTryJobExecution', 1881 'CheckRietveldTryJobExecution',
1882 'CheckSingletonInHeaders', 1882 'CheckSingletonInHeaders',
1883 'CheckSvnModifiedDirectories', 1883 'CheckSvnModifiedDirectories',
1884 'CheckSvnForCommonMimeTypes', 'CheckSvnProperty', 1884 'CheckSvnForCommonMimeTypes', 'CheckSvnProperty',
1885 'RunPythonUnitTests', 'RunPylint', 1885 'RunPythonUnitTests', 'RunPylint',
1886 'RunUnitTests', 'RunUnitTestsInDirectory', 1886 'RunUnitTests', 'RunUnitTestsInDirectory',
1887 'GetPythonUnitTests', 'GetPylint', 1887 'GetPythonUnitTests', 'GetPylint',
1888 'GetUnitTests', 'GetUnitTestsInDirectory', 1888 'GetUnitTests', 'GetUnitTestsInDirectory', 'GetUnitTestsRecursively',
1889 ] 1889 ]
1890 # If this test fails, you should add the relevant test. 1890 # If this test fails, you should add the relevant test.
1891 self.compareMembers(presubmit_canned_checks, members) 1891 self.compareMembers(presubmit_canned_checks, members)
1892 1892
1893 def DescriptionTest(self, check, description1, description2, error_type, 1893 def DescriptionTest(self, check, description1, description2, error_type,
1894 committing): 1894 committing):
1895 change1 = presubmit.Change( 1895 change1 = presubmit.Change(
1896 'foo1', description1, self.fake_root_dir, None, 0, 0, None) 1896 'foo1', description1, self.fake_root_dir, None, 0, 0, None)
1897 input_api1 = self.MockInputApi(change1, committing) 1897 input_api1 = self.MockInputApi(change1, committing)
1898 change2 = presubmit.Change( 1898 change2 = presubmit.Change(
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2909 owners_check=False) 2909 owners_check=False)
2910 self.assertEqual(1, len(results)) 2910 self.assertEqual(1, len(results))
2911 self.assertEqual( 2911 self.assertEqual(
2912 'Found line ending with white spaces in:', results[0]._message) 2912 'Found line ending with white spaces in:', results[0]._message)
2913 self.checkstdout('') 2913 self.checkstdout('')
2914 2914
2915 2915
2916 if __name__ == '__main__': 2916 if __name__ == '__main__':
2917 import unittest 2917 import unittest
2918 unittest.main() 2918 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698