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

Side by Side Diff: tests/presubmit_unittest.py

Issue 2446001: Fix smoke tests on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: '' Created 10 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
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 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. 10 # Fixes include path.
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 self.mox.ReplayAll() 743 self.mox.ReplayAll()
744 744
745 self.assertEqual(len(input_api.DEFAULT_WHITE_LIST), 20) 745 self.assertEqual(len(input_api.DEFAULT_WHITE_LIST), 20)
746 self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 9) 746 self.assertEqual(len(input_api.DEFAULT_BLACK_LIST), 9)
747 for item in files: 747 for item in files:
748 results = filter(input_api.FilterSourceFile, item[0]) 748 results = filter(input_api.FilterSourceFile, item[0])
749 for i in range(len(results)): 749 for i in range(len(results)):
750 self.assertEquals(results[i].LocalPath(), 750 self.assertEquals(results[i].LocalPath(),
751 presubmit.normpath(item[1][i])) 751 presubmit.normpath(item[1][i]))
752 # Same number of expected results. 752 # Same number of expected results.
753 self.assertEquals(sorted([f.LocalPath() for f in results]), 753 self.assertEquals(sorted([f.LocalPath().replace(presubmit.os.sep, '/')
754 for f in results]),
754 sorted(item[1])) 755 sorted(item[1]))
755 756
756 def testCustomFilter(self): 757 def testCustomFilter(self):
757 def FilterSourceFile(affected_file): 758 def FilterSourceFile(affected_file):
758 return 'a' in affected_file.LocalPath() 759 return 'a' in affected_file.LocalPath()
759 files = [('A', 'eeaee'), ('M', 'eeabee'), ('M', 'eebcee')] 760 files = [('A', 'eeaee'), ('M', 'eeabee'), ('M', 'eebcee')]
760 for (action, item) in files: 761 for (action, item) in files:
761 item = presubmit.os.path.join(self.fake_root_dir, item) 762 item = presubmit.os.path.join(self.fake_root_dir, item)
762 presubmit.os.path.exists(item).AndReturn(True) 763 presubmit.os.path.exists(item).AndReturn(True)
763 presubmit.os.path.isdir(item).AndReturn(False) 764 presubmit.os.path.isdir(item).AndReturn(False)
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( 1604 results = presubmit_canned_checks.CheckBuildbotPendingBuilds(
1604 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) 1605 input_api, presubmit.OutputApi, 'uurl', 2, ('foo'))
1605 self.assertEquals(len(results), 1) 1606 self.assertEquals(len(results), 1)
1606 self.assertEquals(results[0].__class__, 1607 self.assertEquals(results[0].__class__,
1607 presubmit.OutputApi.PresubmitNotifyResult) 1608 presubmit.OutputApi.PresubmitNotifyResult)
1608 1609
1609 1610
1610 if __name__ == '__main__': 1611 if __name__ == '__main__':
1611 import unittest 1612 import unittest
1612 unittest.main() 1613 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698