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

Side by Side Diff: tests/git_cl_test.py

Issue 1683173002: Revert of Finally get rid of depot_tools' breakpad. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 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
« no previous file with comments | « tests/breakpad_unittest.py ('k') | tests/trychange_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 os 8 import os
9 import StringIO 9 import StringIO
10 import stat 10 import stat
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 self.mock(subprocess2, 'check_call', self._mocked_call) 81 self.mock(subprocess2, 'check_call', self._mocked_call)
82 self.mock(subprocess2, 'check_output', self._mocked_call) 82 self.mock(subprocess2, 'check_output', self._mocked_call)
83 self.mock(subprocess2, 'communicate', self._mocked_call) 83 self.mock(subprocess2, 'communicate', self._mocked_call)
84 self.mock(git_common, 'is_dirty_git_tree', lambda x: False) 84 self.mock(git_common, 'is_dirty_git_tree', lambda x: False)
85 self.mock(git_common, 'get_or_create_merge_base', 85 self.mock(git_common, 'get_or_create_merge_base',
86 lambda *a: ( 86 lambda *a: (
87 self._mocked_call(['get_or_create_merge_base']+list(a)))) 87 self._mocked_call(['get_or_create_merge_base']+list(a))))
88 self.mock(git_cl, 'BranchExists', lambda _: True) 88 self.mock(git_cl, 'BranchExists', lambda _: True)
89 self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '') 89 self.mock(git_cl, 'FindCodereviewSettingsFile', lambda: '')
90 self.mock(git_cl, 'ask_for_data', self._mocked_call) 90 self.mock(git_cl, 'ask_for_data', self._mocked_call)
91 self.mock(git_cl.breakpad, 'post', self._mocked_call)
92 self.mock(git_cl.breakpad, 'SendStack', self._mocked_call)
91 self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock) 93 self.mock(git_cl.presubmit_support, 'DoPresubmitChecks', PresubmitMock)
92 self.mock(git_cl.rietveld, 'Rietveld', RietveldMock) 94 self.mock(git_cl.rietveld, 'Rietveld', RietveldMock)
93 self.mock(git_cl.rietveld, 'CachingRietveld', RietveldMock) 95 self.mock(git_cl.rietveld, 'CachingRietveld', RietveldMock)
94 self.mock(git_cl.upload, 'RealMain', self.fail) 96 self.mock(git_cl.upload, 'RealMain', self.fail)
95 self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock) 97 self.mock(git_cl.watchlists, 'Watchlists', WatchlistsMock)
96 self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock) 98 self.mock(git_cl.auth, 'get_authenticator_for_host', AuthenticatorMock)
97 # It's important to reset settings to not have inter-tests interference. 99 # It's important to reset settings to not have inter-tests interference.
98 git_cl.settings = None 100 git_cl.settings = None
99 101
100 def tearDown(self): 102 def tearDown(self):
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ((['git', 'config', 'rietveld.tree-status-url'],), ''), 326 ((['git', 'config', 'rietveld.tree-status-url'],), ''),
325 ] 327 ]
326 328
327 @classmethod 329 @classmethod
328 def _dcommit_calls_bypassed(cls): 330 def _dcommit_calls_bypassed(cls):
329 return [ 331 return [
330 ((['git', 332 ((['git',
331 'config', 'branch.working.rietveldissue'],), '12345'), 333 'config', 'branch.working.rietveldissue'],), '12345'),
332 ((['git', 'config', 'branch.working.rietveldserver'],), 334 ((['git', 'config', 'branch.working.rietveldserver'],),
333 'codereview.example.com'), 335 'codereview.example.com'),
336 ((['git', 'config', 'rietveld.tree-status-url'],), ''),
337 (('GitClHooksBypassedCommit',
338 'Issue https://codereview.example.com/12345 bypassed hook when '
339 'committing (tree status was "unset")'), None),
334 ] 340 ]
335 341
336 @classmethod 342 @classmethod
337 def _dcommit_calls_3(cls): 343 def _dcommit_calls_3(cls):
338 return [ 344 return [
339 ((['git', 345 ((['git',
340 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', 346 'diff', '--no-ext-diff', '--stat', '--find-copies-harder',
341 '-l100000', '-C50', 'fake_ancestor_sha', 347 '-l100000', '-C50', 'fake_ancestor_sha',
342 'refs/heads/working'],), 348 'refs/heads/working'],),
343 (' PRESUBMIT.py | 2 +-\n' 349 (' PRESUBMIT.py | 2 +-\n'
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
949 self.calls += [ 955 self.calls += [
950 ((['git', 'apply', '--index', '-p0', '--3way'],), '', 956 ((['git', 'apply', '--index', '-p0', '--3way'],), '',
951 subprocess2.CalledProcessError(1, '', '', '', '')), 957 subprocess2.CalledProcessError(1, '', '', '', '')),
952 ] 958 ]
953 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) 959 self.assertNotEqual(git_cl.main(['patch', '123456']), 0)
954 960
955 if __name__ == '__main__': 961 if __name__ == '__main__':
956 git_cl.logging.basicConfig( 962 git_cl.logging.basicConfig(
957 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 963 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
958 unittest.main() 964 unittest.main()
OLDNEW
« no previous file with comments | « tests/breakpad_unittest.py ('k') | tests/trychange_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698