OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 checkout.py.""" | 6 """Unit tests for checkout.py.""" |
7 | 7 |
8 from __future__ import with_statement | 8 from __future__ import with_statement |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 self.previous_log = None | 144 self.previous_log = None |
145 | 145 |
146 def tearDown(self): | 146 def tearDown(self): |
147 subprocess2.call = self._old_call | 147 subprocess2.call = self._old_call |
148 super(BaseTest, self).tearDown() | 148 super(BaseTest, self).tearDown() |
149 | 149 |
150 def get_patches(self): | 150 def get_patches(self): |
151 return patch.PatchSet([ | 151 return patch.PatchSet([ |
152 patch.FilePatchDiff( | 152 patch.FilePatchDiff( |
153 'svn_utils_test.txt', GIT_PATCH, []), | 153 'svn_utils_test.txt', GIT_PATCH, []), |
154 patch.FilePatchBinary('bin_file', '\x00', []), | 154 # TODO(maruel): Test with is_new == False. |
| 155 patch.FilePatchBinary('bin_file', '\x00', [], is_new=True), |
155 patch.FilePatchDelete('extra', False), | 156 patch.FilePatchDelete('extra', False), |
156 patch.FilePatchDiff('new_dir/subdir/new_file', PATCH_ADD, []), | 157 patch.FilePatchDiff('new_dir/subdir/new_file', PATCH_ADD, []), |
157 ]) | 158 ]) |
158 | 159 |
159 def get_trunk(self, modified): | 160 def get_trunk(self, modified): |
160 tree = {} | 161 tree = {} |
161 subroot = 'trunk/' | 162 subroot = 'trunk/' |
162 for k, v in self.FAKE_REPOS.svn_revs[-1].iteritems(): | 163 for k, v in self.FAKE_REPOS.svn_revs[-1].iteritems(): |
163 if k.startswith(subroot): | 164 if k.startswith(subroot): |
164 f = k[len(subroot):] | 165 f = k[len(subroot):] |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 if '-v' in sys.argv: | 541 if '-v' in sys.argv: |
541 DEBUGGING = True | 542 DEBUGGING = True |
542 logging.basicConfig( | 543 logging.basicConfig( |
543 level=logging.DEBUG, | 544 level=logging.DEBUG, |
544 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 545 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
545 else: | 546 else: |
546 logging.basicConfig( | 547 logging.basicConfig( |
547 level=logging.ERROR, | 548 level=logging.ERROR, |
548 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 549 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
549 unittest.main() | 550 unittest.main() |
OLD | NEW |