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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/git_unittest.py

Issue 2680173002: Move webkitpy/common/checkout/scm/* -> webkitpy/common/checkout/. (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import unittest 5 import unittest
6 6
7 from webkitpy.common.system.executive import Executive, ScriptError 7 from webkitpy.common.system.executive import Executive, ScriptError
8 from webkitpy.common.system.executive_mock import MockExecutive 8 from webkitpy.common.system.executive_mock import MockExecutive
9 from webkitpy.common.system.filesystem import FileSystem 9 from webkitpy.common.system.filesystem import FileSystem
10 from webkitpy.common.system.filesystem_mock import MockFileSystem 10 from webkitpy.common.system.filesystem_mock import MockFileSystem
11 from webkitpy.common.checkout.scm.git import Git 11 from webkitpy.common.checkout.git import Git
12 12
13 13
14 class GitTestWithRealFilesystemAndExecutive(unittest.TestCase): 14 class GitTestWithRealFilesystemAndExecutive(unittest.TestCase):
15 15
16 def setUp(self): 16 def setUp(self):
17 self.executive = Executive() 17 self.executive = Executive()
18 self.filesystem = FileSystem() 18 self.filesystem = FileSystem()
19 self.original_cwd = self.filesystem.getcwd() 19 self.original_cwd = self.filesystem.getcwd()
20 20
21 # Set up fresh git repository with one commit. 21 # Set up fresh git repository with one commit.
22 self.untracking_checkout_path = self._mkdtemp(suffix='-git_unittest_untr acking') 22 self.untracking_checkout_path = self._mkdtemp(suffix='-git_unittest_untr acking')
23 self._run(['git', 'init', self.untracking_checkout_path]) 23 self._run(['git', 'init', self.untracking_checkout_path])
24 self._chdir(self.untracking_checkout_path) 24 self._chdir(self.untracking_checkout_path)
25 self._write_text_file('foo_file', 'foo') 25 self._write_text_file('foo_file', 'foo')
26 self._run(['git', 'add', 'foo_file']) 26 self._run(['git', 'add', 'foo_file'])
27 self._run(['git', 'commit', '-am', 'dummy commit']) 27 self._run(['git', 'commit', '-am', 'dummy commit'])
28 self.untracking_scm = Git(cwd=self.untracking_checkout_path, filesystem= self.filesystem, executive=self.executive) 28 self.untracking_scm = Git(cwd=self.untracking_checkout_path, filesystem= self.filesystem, executive=self.executive)
29 29
30 # Then set up a second git repo that tracks the first one. 30 # Then set up a second git repo that tracks the first one.
31 self.tracking_git_checkout_path = self._mkdtemp(suffix='-git_unittest_tr acking') 31 self.tracking_git_checkout_path = self._mkdtemp(suffix='-git_unittest_tr acking')
32 self._run(['git', 'clone', '--quiet', self.untracking_checkout_path, sel f.tracking_git_checkout_path]) 32 self._run(['git', 'clone', '--quiet', self.untracking_checkout_path, sel f.tracking_git_checkout_path])
33 self._chdir(self.tracking_git_checkout_path) 33 self._chdir(self.tracking_git_checkout_path)
34 self.tracking_scm = Git(cwd=self.tracking_git_checkout_path, filesystem= self.filesystem, executive=self.executive) 34 self.tracking_scm = Git(cwd=self.tracking_git_checkout_path, filesystem= self.filesystem, executive=self.executive)
35 35
36
37 def tearDown(self): 36 def tearDown(self):
38 self._chdir(self.original_cwd) 37 self._chdir(self.original_cwd)
39 self._run(['rm', '-rf', self.tracking_git_checkout_path]) 38 self._run(['rm', '-rf', self.tracking_git_checkout_path])
40 self._run(['rm', '-rf', self.untracking_checkout_path]) 39 self._run(['rm', '-rf', self.untracking_checkout_path])
41 40
42 def _join(self, *comps): 41 def _join(self, *comps):
43 return self.filesystem.join(*comps) 42 return self.filesystem.join(*comps)
44 43
45 def _chdir(self, path): 44 def _chdir(self, path):
46 self.filesystem.chdir(path) 45 self.filesystem.chdir(path)
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 ] 237 ]
239 # pylint: disable=protected-access 238 # pylint: disable=protected-access
240 scm._run_git = lambda args: '\x00'.join(status_lines) + '\x00' 239 scm._run_git = lambda args: '\x00'.join(status_lines) + '\x00'
241 self.assertEqual( 240 self.assertEqual(
242 scm.unstaged_changes(), 241 scm.unstaged_changes(),
243 { 242 {
244 'd/modified.txt': 'M', 243 'd/modified.txt': 'M',
245 'd/deleted.txt': 'D', 244 'd/deleted.txt': 'D',
246 'd/untracked.txt': '?', 245 'd/untracked.txt': '?',
247 }) 246 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698