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 |
11 import sys | 11 import sys |
12 import unittest | 12 import unittest |
13 | 13 |
14 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | 14 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) |
15 | 15 |
16 from testing_support.auto_stub import TestCase | 16 from testing_support.auto_stub import TestCase |
17 | 17 |
18 import git_cl | 18 import git_cl |
19 import subprocess2 | 19 import subprocess2 |
20 | 20 |
| 21 # Make submodule be able to find the commands. |
| 22 git_cl.subcommand.MAIN_MODULE = git_cl |
| 23 |
21 | 24 |
22 class PresubmitMock(object): | 25 class PresubmitMock(object): |
23 def __init__(self, *args, **kwargs): | 26 def __init__(self, *args, **kwargs): |
24 self.reviewers = [] | 27 self.reviewers = [] |
25 @staticmethod | 28 @staticmethod |
26 def should_continue(): | 29 def should_continue(): |
27 return True | 30 return True |
28 | 31 |
29 | 32 |
30 class RietveldMock(object): | 33 class RietveldMock(object): |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 obj = git_cl.ChangeDescription(orig) | 715 obj = git_cl.ChangeDescription(orig) |
713 obj.update_reviewers(reviewers) | 716 obj.update_reviewers(reviewers) |
714 actual.append(obj.description) | 717 actual.append(obj.description) |
715 self.assertEqual(expected, actual) | 718 self.assertEqual(expected, actual) |
716 | 719 |
717 | 720 |
718 if __name__ == '__main__': | 721 if __name__ == '__main__': |
719 git_cl.logging.basicConfig( | 722 git_cl.logging.basicConfig( |
720 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 723 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
721 unittest.main() | 724 unittest.main() |
OLD | NEW |