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

Side by Side Diff: tests/presubmit_unittest.py

Issue 11114005: implement per-file OWNERS support (Closed) Base URL: https://git.chromium.org/chromium/tools/depot_tools.git@master
Patch Set: update w/ more review feedback Created 8 years, 2 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
« no previous file with comments | « tests/owners_unittest.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 logging 10 import logging
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 self.fake_root_dir, 741 self.fake_root_dir,
742 None, 742 None,
743 0, 743 0,
744 0, 744 0,
745 None) 745 None)
746 746
747 executer = presubmit.GetTrySlavesExecuter() 747 executer = presubmit.GetTrySlavesExecuter()
748 expected_result1 = ['1', '2'] 748 expected_result1 = ['1', '2']
749 expected_result2 = ['a', 'b', 'c'] 749 expected_result2 = ['a', 'b', 'c']
750 script = self.presubmit_tryslave_project % ( 750 script = self.presubmit_tryslave_project % (
751 repr('foo'), repr(expected_result1), repr(expected_result2)) 751 repr('foo'), repr(expected_result1), repr(expected_result2))
752 self.assertEqual( 752 self.assertEqual(
753 expected_result1, executer.ExecPresubmitScript(script, '', 'foo', 753 expected_result1, executer.ExecPresubmitScript(script, '', 'foo',
754 change)) 754 change))
755 self.assertEqual( 755 self.assertEqual(
756 expected_result2, executer.ExecPresubmitScript(script, '', 'bar', 756 expected_result2, executer.ExecPresubmitScript(script, '', 'bar',
757 change)) 757 change))
758 758
759 def testDoGetTrySlaves(self): 759 def testDoGetTrySlaves(self):
760 join = presubmit.os.path.join 760 join = presubmit.os.path.join
761 filename = 'foo.cc' 761 filename = 'foo.cc'
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
861 def testMembersChanged(self): 861 def testMembersChanged(self):
862 self.mox.ReplayAll() 862 self.mox.ReplayAll()
863 members = [ 863 members = [
864 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles', 864 'AbsoluteLocalPaths', 'AffectedFiles', 'AffectedSourceFiles',
865 'AffectedTextFiles', 865 'AffectedTextFiles',
866 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST', 866 'DEFAULT_BLACK_LIST', 'DEFAULT_WHITE_LIST',
867 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths', 867 'DepotToLocalPath', 'FilterSourceFile', 'LocalPaths',
868 'LocalToDepotPath', 868 'LocalToDepotPath',
869 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths', 869 'PresubmitLocalPath', 'ReadFile', 'RightHandSideLines', 'ServerPaths',
870 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ', 870 'basename', 'cPickle', 'cStringIO', 'canned_checks', 'change', 'environ',
871 'host_url', 'is_committing', 'json', 'logging', 'marshal', 'os_listdir', 871 'glob', 'host_url', 'is_committing', 'json', 'logging', 'marshal',
872 'os_walk', 872 'os_listdir', 'os_walk',
873 'os_path', 'owners_db', 'pickle', 'platform', 'python_executable', 're', 873 'os_path', 'owners_db', 'pickle', 'platform', 'python_executable', 're',
874 'rietveld', 'subprocess', 'tbr', 'tempfile', 'time', 'traceback', 874 'rietveld', 'subprocess', 'tbr', 'tempfile', 'time', 'traceback',
875 'unittest', 'urllib2', 'version', 'verbose', 875 'unittest', 'urllib2', 'version', 'verbose',
876 ] 876 ]
877 # If this test fails, you should add the relevant test. 877 # If this test fails, you should add the relevant test.
878 self.compareMembers( 878 self.compareMembers(
879 presubmit.InputApi(self.fake_change, './.', False, None, False), 879 presubmit.InputApi(self.fake_change, './.', False, None, False),
880 members) 880 members)
881 881
882 def testDepotToLocalPath(self): 882 def testDepotToLocalPath(self):
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2484 owners_check=False) 2484 owners_check=False)
2485 self.assertEqual(1, len(results)) 2485 self.assertEqual(1, len(results))
2486 self.assertEqual( 2486 self.assertEqual(
2487 'Found line ending with white spaces in:', results[0]._message) 2487 'Found line ending with white spaces in:', results[0]._message)
2488 self.checkstdout('') 2488 self.checkstdout('')
2489 2489
2490 2490
2491 if __name__ == '__main__': 2491 if __name__ == '__main__':
2492 import unittest 2492 import unittest
2493 unittest.main() 2493 unittest.main()
OLDNEW
« no previous file with comments | « tests/owners_unittest.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698