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

Side by Side Diff: tests/git_cl_test.py

Issue 2453823002: depot_tools: Remove DoGetTrySlaves, GetTrySlavesExecuter, GetPreferredTrySlaves (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 | « presubmit_support.py ('k') | tests/presubmit_unittest.py » ('j') | 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 git_cl.py.""" 6 """Unit tests for git_cl.py."""
7 7
8 import json 8 import json
9 import os 9 import os
10 import StringIO 10 import StringIO
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 ] 1878 ]
1879 self.assertEqual(0, git_cl.main(['issue', '--json', 'output.json'])) 1879 self.assertEqual(0, git_cl.main(['issue', '--json', 'output.json']))
1880 1880
1881 def test_git_cl_try_default_cq_dry_run(self): 1881 def test_git_cl_try_default_cq_dry_run(self):
1882 self.mock(git_cl.Changelist, 'GetChange', 1882 self.mock(git_cl.Changelist, 'GetChange',
1883 lambda _, *a: ( 1883 lambda _, *a: (
1884 self._mocked_call(['GetChange']+list(a)))) 1884 self._mocked_call(['GetChange']+list(a))))
1885 self.mock(git_cl.presubmit_support, 'DoGetTryMasters', 1885 self.mock(git_cl.presubmit_support, 'DoGetTryMasters',
1886 lambda *_, **__: ( 1886 lambda *_, **__: (
1887 self._mocked_call(['DoGetTryMasters']))) 1887 self._mocked_call(['DoGetTryMasters'])))
1888 self.mock(git_cl.presubmit_support, 'DoGetTrySlaves',
1889 lambda *_, **__: (
1890 self._mocked_call(['DoGetTrySlaves'])))
1891 self.mock(git_cl._RietveldChangelistImpl, 'SetCQState', 1888 self.mock(git_cl._RietveldChangelistImpl, 'SetCQState',
1892 lambda _, s: self._mocked_call(['SetCQState', s])) 1889 lambda _, s: self._mocked_call(['SetCQState', s]))
1893 self.calls = [ 1890 self.calls = [
1894 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'), 1891 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
1895 ((['git', 'config', 'branch.feature.rietveldissue'],), '123'), 1892 ((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
1896 ((['git', 'config', 'rietveld.autoupdate'],), ''), 1893 ((['git', 'config', 'rietveld.autoupdate'],), ''),
1897 ((['git', 'config', 'rietveld.server'],), 1894 ((['git', 'config', 'rietveld.server'],),
1898 'https://codereview.chromium.org'), 1895 'https://codereview.chromium.org'),
1899 ((['git', 'config', 'branch.feature.rietveldserver'],), ''), 1896 ((['git', 'config', 'branch.feature.rietveldserver'],), ''),
1900 ((['git', 'config', 'branch.feature.merge'],), 'feature'), 1897 ((['git', 'config', 'branch.feature.merge'],), 'feature'),
1901 ((['git', 'config', 'branch.feature.remote'],), 'origin'), 1898 ((['git', 'config', 'branch.feature.remote'],), 'origin'),
1902 ((['get_or_create_merge_base', 'feature', 'feature'],), 1899 ((['get_or_create_merge_base', 'feature', 'feature'],),
1903 'fake_ancestor_sha'), 1900 'fake_ancestor_sha'),
1904 ((['GetChange', 'fake_ancestor_sha', None], ), 1901 ((['GetChange', 'fake_ancestor_sha', None], ),
1905 git_cl.presubmit_support.GitChange( 1902 git_cl.presubmit_support.GitChange(
1906 '', '', '', '', '', '', '', '')), 1903 '', '', '', '', '', '', '', '')),
1907 ((['git', 'rev-parse', '--show-cdup'],), '../'), 1904 ((['git', 'rev-parse', '--show-cdup'],), '../'),
1908 ((['DoGetTryMasters'], ), None), 1905 ((['DoGetTryMasters'], ), None),
1909 ((['DoGetTrySlaves'], ), None),
1910 ((['SetCQState', git_cl._CQState.DRY_RUN], ), None), 1906 ((['SetCQState', git_cl._CQState.DRY_RUN], ), None),
1911 ] 1907 ]
1912 out = StringIO.StringIO() 1908 out = StringIO.StringIO()
1913 self.mock(git_cl.sys, 'stdout', out) 1909 self.mock(git_cl.sys, 'stdout', out)
1914 self.assertEqual(0, git_cl.main(['try'])) 1910 self.assertEqual(0, git_cl.main(['try']))
1915 self.assertEqual( 1911 self.assertEqual(
1916 out.getvalue(), 1912 out.getvalue(),
1917 'scheduled CQ Dry Run on https://codereview.chromium.org/123\n') 1913 'scheduled CQ Dry Run on https://codereview.chromium.org/123\n')
1918 1914
1919 def test_git_cl_try_buildbucket_with_properties(self): 1915 def test_git_cl_try_buildbucket_with_properties(self):
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning') 2250 self.assertNotRegexpMatches(sys.stdout.getvalue(), 'Warning')
2255 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:') 2251 self.assertRegexpMatches(sys.stdout.getvalue(), '^Failures:')
2256 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:') 2252 self.assertRegexpMatches(sys.stdout.getvalue(), 'Started:')
2257 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs') 2253 self.assertRegexpMatches(sys.stdout.getvalue(), '2 try jobs')
2258 2254
2259 2255
2260 if __name__ == '__main__': 2256 if __name__ == '__main__':
2261 git_cl.logging.basicConfig( 2257 git_cl.logging.basicConfig(
2262 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 2258 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
2263 unittest.main() 2259 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | tests/presubmit_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698