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

Side by Side Diff: tests/presubmit_unittest.py

Issue 6459010: Improve presubmit_support.py handling of git checkout. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 10 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/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 # pylint is too confused. 8 # pylint is too confused.
9 # pylint: disable=E1101,E1103,W0212,W0403 9 # pylint: disable=E1101,E1103,W0212,W0403
10 10
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 self.assertEqual(['win', 'linux'], 589 self.assertEqual(['win', 'linux'],
590 presubmit.DoGetTrySlaves([filename, filename_linux], 590 presubmit.DoGetTrySlaves([filename, filename_linux],
591 self.fake_root_dir, None, False, 591 self.fake_root_dir, None, False,
592 output)) 592 output))
593 593
594 def testMain(self): 594 def testMain(self):
595 # OptParser calls presubmit.os.path.exists and is a pain when mocked. 595 # OptParser calls presubmit.os.path.exists and is a pain when mocked.
596 self.UnMock(presubmit.os.path, 'exists') 596 self.UnMock(presubmit.os.path, 'exists')
597 self.mox.StubOutWithMock(presubmit, 'DoPresubmitChecks') 597 self.mox.StubOutWithMock(presubmit, 'DoPresubmitChecks')
598 self.mox.StubOutWithMock(presubmit, 'ParseFiles') 598 self.mox.StubOutWithMock(presubmit, 'ParseFiles')
599 presubmit.os.path.isdir(presubmit.os.path.join(self.fake_root_dir, '.svn')
600 ).AndReturn(False)
599 presubmit.os.path.isdir(presubmit.os.path.join(self.fake_root_dir, '.git') 601 presubmit.os.path.isdir(presubmit.os.path.join(self.fake_root_dir, '.git')
600 ).AndReturn(False) 602 ).AndReturn(False)
601 presubmit.os.path.isdir(presubmit.os.path.join(self.fake_root_dir, '.svn') 603 presubmit.subprocess.call(
602 ).AndReturn(False) 604 ['git', 'rev-parse', '--show-cdup'],
603 #presubmit.ParseFiles([], None).AndReturn([]) 605 cwd=self.fake_root_dir,
606 stdout=presubmit.subprocess.PIPE).AndReturn(1)
604 presubmit.DoPresubmitChecks(mox.IgnoreArg(), False, False, 607 presubmit.DoPresubmitChecks(mox.IgnoreArg(), False, False,
605 mox.IgnoreArg(), 608 mox.IgnoreArg(),
606 mox.IgnoreArg(), 609 mox.IgnoreArg(),
607 None, False).AndReturn(False) 610 None, False).AndReturn(False)
608 self.mox.ReplayAll() 611 self.mox.ReplayAll()
609 612
610 self.assertEquals(True, 613 self.assertEquals(True,
611 presubmit.Main(['presubmit', '--root', 614 presubmit.Main(['presubmit', '--root',
612 self.fake_root_dir])) 615 self.fake_root_dir]))
613 616
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 results = presubmit_canned_checks.CheckBuildbotPendingBuilds( 1762 results = presubmit_canned_checks.CheckBuildbotPendingBuilds(
1760 input_api, presubmit.OutputApi, 'uurl', 2, ('foo')) 1763 input_api, presubmit.OutputApi, 'uurl', 2, ('foo'))
1761 self.assertEquals(len(results), 1) 1764 self.assertEquals(len(results), 1)
1762 self.assertEquals(results[0].__class__, 1765 self.assertEquals(results[0].__class__,
1763 presubmit.OutputApi.PresubmitNotifyResult) 1766 presubmit.OutputApi.PresubmitNotifyResult)
1764 1767
1765 1768
1766 if __name__ == '__main__': 1769 if __name__ == '__main__':
1767 import unittest 1770 import unittest
1768 unittest.main() 1771 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