| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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_common.py""" | 6 """Unit tests for git_common.py""" |
| 7 | 7 |
| 8 import binascii | 8 import binascii |
| 9 import collections | 9 import collections |
| 10 import os | 10 import os |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 self.assertEquals(self.repo.run(self.gc.upstream, 'bobly'), None) | 384 self.assertEquals(self.repo.run(self.gc.upstream, 'bobly'), None) |
| 385 self.assertEquals(self.repo.run(self.gc.upstream, 'master'), None) | 385 self.assertEquals(self.repo.run(self.gc.upstream, 'master'), None) |
| 386 self.repo.git('checkout', '-tb', 'happybranch', 'master') | 386 self.repo.git('checkout', '-tb', 'happybranch', 'master') |
| 387 self.assertEquals(self.repo.run(self.gc.upstream, 'happybranch'), | 387 self.assertEquals(self.repo.run(self.gc.upstream, 'happybranch'), |
| 388 'master') | 388 'master') |
| 389 | 389 |
| 390 def testNormalizedVersion(self): | 390 def testNormalizedVersion(self): |
| 391 self.assertTrue(all( | 391 self.assertTrue(all( |
| 392 isinstance(x, int) for x in self.repo.run(self.gc.get_git_version))) | 392 isinstance(x, int) for x in self.repo.run(self.gc.get_git_version))) |
| 393 | 393 |
| 394 @unittest.expectedFailure | |
| 395 def testGetBranchesInfo(self): | 394 def testGetBranchesInfo(self): |
| 396 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') | 395 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') |
| 397 self.repo.git('checkout', '-tb', 'happybranch', 'master') | 396 self.repo.git('checkout', '-tb', 'happybranch', 'master') |
| 398 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') | 397 self.repo.git('commit', '--allow-empty', '-am', 'foooooo') |
| 399 self.repo.git('checkout', '-tb', 'child', 'happybranch') | 398 self.repo.git('checkout', '-tb', 'child', 'happybranch') |
| 400 | 399 |
| 401 self.repo.git('checkout', '-tb', 'to_delete', 'master') | 400 self.repo.git('checkout', '-tb', 'to_delete', 'master') |
| 402 self.repo.git('checkout', '-tb', 'parent_gone', 'to_delete') | 401 self.repo.git('checkout', '-tb', 'parent_gone', 'to_delete') |
| 403 self.repo.git('branch', '-D', 'to_delete') | 402 self.repo.git('branch', '-D', 'to_delete') |
| 404 | 403 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 423 'master': ( | 422 'master': ( |
| 424 self.repo.run(self.gc.hash_one, 'master', short=True), | 423 self.repo.run(self.gc.hash_one, 'master', short=True), |
| 425 '', | 424 '', |
| 426 None, | 425 None, |
| 427 None | 426 None |
| 428 ), | 427 ), |
| 429 '': None, | 428 '': None, |
| 430 'parent_gone': ( | 429 'parent_gone': ( |
| 431 self.repo.run(self.gc.hash_one, 'parent_gone', short=True), | 430 self.repo.run(self.gc.hash_one, 'parent_gone', short=True), |
| 432 'to_delete', | 431 'to_delete', |
| 433 1 if supports_track else None, | 432 None, |
| 434 None | 433 None |
| 435 ), | 434 ), |
| 436 'to_delete': None | 435 'to_delete': None |
| 437 } | 436 } |
| 438 self.assertEquals(expected, actual) | 437 self.assertEquals(expected, actual) |
| 439 | 438 |
| 440 | 439 |
| 441 class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, | 440 class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, |
| 442 GitCommonTestBase): | 441 GitCommonTestBase): |
| 443 REPO_SCHEMA = """ | 442 REPO_SCHEMA = """ |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 self.assertIsNotNone(self.gc.thaw()) # One thaw should thaw everything | 739 self.assertIsNotNone(self.gc.thaw()) # One thaw should thaw everything |
| 741 | 740 |
| 742 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) | 741 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) |
| 743 | 742 |
| 744 self.repo.run(inner) | 743 self.repo.run(inner) |
| 745 | 744 |
| 746 | 745 |
| 747 if __name__ == '__main__': | 746 if __name__ == '__main__': |
| 748 sys.exit(coverage_utils.covered_main( | 747 sys.exit(coverage_utils.covered_main( |
| 749 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py'))) | 748 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py'))) |
| OLD | NEW |