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

Side by Side Diff: tests/presubmit_unittest.py

Issue 10828393: Fix depot_tools presubmit check for ubuntu 12.04. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 4 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 | « testing_support/super_mox.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 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 1585
1586 self.mox.ReplayAll() 1586 self.mox.ReplayAll()
1587 1587
1588 results1 = check(input_api1, presubmit.OutputApi, None) 1588 results1 = check(input_api1, presubmit.OutputApi, None)
1589 self.assertEquals(results1, []) 1589 self.assertEquals(results1, [])
1590 results2 = check(input_api2, presubmit.OutputApi, None) 1590 results2 = check(input_api2, presubmit.OutputApi, None)
1591 self.assertEquals(len(results2), 1) 1591 self.assertEquals(len(results2), 1)
1592 self.assertEquals(results2[0].__class__, error_type) 1592 self.assertEquals(results2[0].__class__, error_type)
1593 1593
1594 def ReadFileTest(self, check, content1, content2, error_type): 1594 def ReadFileTest(self, check, content1, content2, error_type):
1595 self.mox.StubOutWithMock(presubmit.InputApi, 'ReadFile')
1596 change1 = presubmit.Change( 1595 change1 = presubmit.Change(
1597 'foo1', 'foo1\n', self.fake_root_dir, None, 0, 0, None) 1596 'foo1', 'foo1\n', self.fake_root_dir, None, 0, 0, None)
1598 input_api1 = self.MockInputApi(change1, False) 1597 input_api1 = self.MockInputApi(change1, False)
1599 affected_file1 = self.mox.CreateMock(presubmit.SvnAffectedFile) 1598 affected_file1 = self.mox.CreateMock(presubmit.SvnAffectedFile)
1600 input_api1.AffectedSourceFiles(None).AndReturn([affected_file1]) 1599 input_api1.AffectedSourceFiles(None).AndReturn([affected_file1])
1601 input_api1.ReadFile(affected_file1, 'rb').AndReturn(content1) 1600 input_api1.ReadFile(affected_file1, 'rb').AndReturn(content1)
1602 change2 = presubmit.Change( 1601 change2 = presubmit.Change(
1603 'foo2', 'foo2\n', self.fake_root_dir, None, 0, 0, None) 1602 'foo2', 'foo2\n', self.fake_root_dir, None, 0, 0, None)
1604 input_api2 = self.MockInputApi(change2, False) 1603 input_api2 = self.MockInputApi(change2, False)
1605 affected_file2 = self.mox.CreateMock(presubmit.SvnAffectedFile) 1604 affected_file2 = self.mox.CreateMock(presubmit.SvnAffectedFile)
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2479 owners_check=False) 2478 owners_check=False)
2480 self.assertEqual(1, len(results)) 2479 self.assertEqual(1, len(results))
2481 self.assertEqual( 2480 self.assertEqual(
2482 'Found line ending with white spaces in:', results[0]._message) 2481 'Found line ending with white spaces in:', results[0]._message)
2483 self.checkstdout('') 2482 self.checkstdout('')
2484 2483
2485 2484
2486 if __name__ == '__main__': 2485 if __name__ == '__main__':
2487 import unittest 2486 import unittest
2488 unittest.main() 2487 unittest.main()
OLDNEW
« no previous file with comments | « testing_support/super_mox.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698