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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 if git: | 192 if git: |
193 # Hackish to verify _branches() internal function. | 193 # Hackish to verify _branches() internal function. |
194 # pylint: disable=W0212 | 194 # pylint: disable=W0212 |
195 self.assertEquals( | 195 self.assertEquals( |
196 (['master', 'working_branch'], 'working_branch'), | 196 (['master', 'working_branch'], 'working_branch'), |
197 co.checkout._branches()) | 197 co.checkout._branches()) |
198 | 198 |
199 # Verify that the patch is applied even for read only checkout. | 199 # Verify that the patch is applied even for read only checkout. |
200 self.assertTree(self.get_trunk(True), root) | 200 self.assertTree(self.get_trunk(True), root) |
201 fake_author = self.FAKE_REPOS.USERS[1][0] | 201 fake_author = self.FAKE_REPOS.USERS[1][0] |
202 revision = co.commit('msg', fake_author) | 202 revision = co.commit(u'msg', fake_author) |
203 # Nothing changed. | 203 # Nothing changed. |
204 self.assertTree(self.get_trunk(True), root) | 204 self.assertTree(self.get_trunk(True), root) |
205 | 205 |
206 if read_only: | 206 if read_only: |
207 self.assertEquals('FAKE', revision) | 207 self.assertEquals('FAKE', revision) |
208 self.assertEquals(self.previous_log['revision'], co.prepare()) | 208 self.assertEquals(self.previous_log['revision'], co.prepare()) |
209 # Changes should be reverted now. | 209 # Changes should be reverted now. |
210 self.assertTree(self.get_trunk(False), root) | 210 self.assertTree(self.get_trunk(False), root) |
211 expected = self.previous_log | 211 expected = self.previous_log |
212 else: | 212 else: |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 self.assertTree(self.get_trunk(False), root) | 491 self.assertTree(self.get_trunk(False), root) |
492 patches = self.get_patches() | 492 patches = self.get_patches() |
493 co.apply_patch(patches) | 493 co.apply_patch(patches) |
494 self.assertEquals( | 494 self.assertEquals( |
495 ['bin_file', 'extra', 'new_dir/subdir/new_file', 'svn_utils_test.txt'], | 495 ['bin_file', 'extra', 'new_dir/subdir/new_file', 'svn_utils_test.txt'], |
496 sorted(patches.filenames)) | 496 sorted(patches.filenames)) |
497 | 497 |
498 # Verify that the patch is applied even for read only checkout. | 498 # Verify that the patch is applied even for read only checkout. |
499 self.assertTree(self.get_trunk(True), root) | 499 self.assertTree(self.get_trunk(True), root) |
500 if read_only: | 500 if read_only: |
501 revision = co.commit('msg', self.FAKE_REPOS.USERS[1][0]) | 501 revision = co.commit(u'msg', self.FAKE_REPOS.USERS[1][0]) |
502 self.assertEquals('FAKE', revision) | 502 self.assertEquals('FAKE', revision) |
503 else: | 503 else: |
504 try: | 504 try: |
505 co.commit('msg', self.FAKE_REPOS.USERS[1][0]) | 505 co.commit(u'msg', self.FAKE_REPOS.USERS[1][0]) |
506 self.fail() | 506 self.fail() |
507 except NotImplementedError: | 507 except NotImplementedError: |
508 pass | 508 pass |
509 self.assertTree(self.get_trunk(True), root) | 509 self.assertTree(self.get_trunk(True), root) |
510 # Verify that prepare() is a no-op. | 510 # Verify that prepare() is a no-op. |
511 self.assertEquals(None, co.prepare()) | 511 self.assertEquals(None, co.prepare()) |
512 self.assertTree(self.get_trunk(True), root) | 512 self.assertTree(self.get_trunk(True), root) |
513 | 513 |
514 def testAllRW(self): | 514 def testAllRW(self): |
515 self._check(False) | 515 self._check(False) |
(...skipping 21 matching lines...) Expand all Loading... |
537 if '-v' in sys.argv: | 537 if '-v' in sys.argv: |
538 DEBUGGING = True | 538 DEBUGGING = True |
539 logging.basicConfig( | 539 logging.basicConfig( |
540 level=logging.DEBUG, | 540 level=logging.DEBUG, |
541 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 541 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
542 else: | 542 else: |
543 logging.basicConfig( | 543 logging.basicConfig( |
544 level=logging.ERROR, | 544 level=logging.ERROR, |
545 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 545 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
546 unittest.main() | 546 unittest.main() |
OLD | NEW |