| OLD | NEW |
| 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 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 'test3 test2', # test2 -> test3 | 710 'test3 test2', # test2 -> test3 |
| 711 'test3.1 test2', # test2 -> test3.1 | 711 'test3.1 test2', # test2 -> test3.1 |
| 712 'test4 test3', # test3 -> test4 | 712 'test4 test3', # test3 -> test4 |
| 713 'test5 test4', # test4 -> test5 | 713 'test5 test4', # test4 -> test5 |
| 714 'test6 test0', # test0 -> test6 | 714 'test6 test0', # test0 -> test6 |
| 715 'test7', # test7 | 715 'test7', # test7 |
| 716 ] | 716 ] |
| 717 return '\n'.join(branch_deps) | 717 return '\n'.join(branch_deps) |
| 718 self.mock(git_cl, 'RunGit', mock_run_git) | 718 self.mock(git_cl, 'RunGit', mock_run_git) |
| 719 | 719 |
| 720 git_cl.settings = git_cl.Settings() |
| 721 self.mock(git_cl.settings, 'GetIsGerrit', lambda: False) |
| 722 |
| 720 class RecordCalls: | 723 class RecordCalls: |
| 721 times_called = 0 | 724 times_called = 0 |
| 722 record_calls = RecordCalls() | 725 record_calls = RecordCalls() |
| 723 def mock_CMDupload(*args, **_kwargs): | 726 def mock_CMDupload(*args, **_kwargs): |
| 724 record_calls.times_called += 1 | 727 record_calls.times_called += 1 |
| 725 return 0 | 728 return 0 |
| 726 self.mock(git_cl, 'CMDupload', mock_CMDupload) | 729 self.mock(git_cl, 'CMDupload', mock_CMDupload) |
| 727 | 730 |
| 728 self.calls = [ | 731 self.calls = [ |
| 729 (('[Press enter to continue or ctrl-C to quit]',), ''), | 732 (('[Press enter to continue or ctrl-C to quit]',), ''), |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 self.calls += [ | 955 self.calls += [ |
| 953 ((['git', 'apply', '--index', '-p0', '--3way'],), '', | 956 ((['git', 'apply', '--index', '-p0', '--3way'],), '', |
| 954 subprocess2.CalledProcessError(1, '', '', '', '')), | 957 subprocess2.CalledProcessError(1, '', '', '', '')), |
| 955 ] | 958 ] |
| 956 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) | 959 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) |
| 957 | 960 |
| 958 if __name__ == '__main__': | 961 if __name__ == '__main__': |
| 959 git_cl.logging.basicConfig( | 962 git_cl.logging.basicConfig( |
| 960 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) |
| 961 unittest.main() | 964 unittest.main() |
| OLD | NEW |