Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: tests/git_common_test.py

Issue 1342383002: Add a git-drover. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « man/src/git-drover.demo.3.sh ('k') | tests/git_drover_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 import shutil
11 import signal 12 import signal
12 import sys 13 import sys
13 import tempfile 14 import tempfile
14 import time 15 import time
15 import unittest 16 import unittest
16 17
17 DEPOT_TOOLS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 18 DEPOT_TOOLS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
18 sys.path.insert(0, DEPOT_TOOLS_ROOT) 19 sys.path.insert(0, DEPOT_TOOLS_ROOT)
19 20
20 from testing_support import coverage_utils 21 from testing_support import coverage_utils
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 737
737 # Thaw it out! 738 # Thaw it out!
738 self.assertIsNone(self.gc.thaw()) 739 self.assertIsNone(self.gc.thaw())
739 self.assertIsNotNone(self.gc.thaw()) # One thaw should thaw everything 740 self.assertIsNotNone(self.gc.thaw()) # One thaw should thaw everything
740 741
741 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1) 742 self.assertEquals(self.repo.git('status', '--porcelain').stdout, STATUS_1)
742 743
743 self.repo.run(inner) 744 self.repo.run(inner)
744 745
745 746
747 class GitMakeWorkdir(git_test_utils.GitRepoReadOnlyTestBase, GitCommonTestBase):
748 def setUp(self):
749 self._tempdir = tempfile.mkdtemp()
750
751 def tearDown(self):
752 shutil.rmtree(self._tempdir)
753
754 REPO_SCHEMA = """
755 A
756 """
757
758 def testMakeWorkdir(self):
759 if not hasattr(os, 'symlink'):
760 return
761
762 workdir = os.path.join(self._tempdir, 'workdir')
763 self.gc.make_workdir(os.path.join(self.repo.repo_path, '.git'),
764 os.path.join(workdir, '.git'))
765 EXPECTED_LINKS = [
766 'config', 'info', 'hooks', 'logs/refs', 'objects', 'refs',
767 ]
768 for path in EXPECTED_LINKS:
769 self.assertTrue(os.path.islink(os.path.join(workdir, '.git', path)))
770 self.assertEqual(os.path.realpath(os.path.join(workdir, '.git', path)),
771 os.path.join(self.repo.repo_path, '.git', path))
772 self.assertFalse(os.path.islink(os.path.join(workdir, '.git', 'HEAD')))
773
774
775
746 if __name__ == '__main__': 776 if __name__ == '__main__':
747 sys.exit(coverage_utils.covered_main( 777 sys.exit(coverage_utils.covered_main(
748 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py'))) 778 os.path.join(DEPOT_TOOLS_ROOT, 'git_common.py')))
OLDNEW
« no previous file with comments | « man/src/git-drover.demo.3.sh ('k') | tests/git_drover_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698