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

Side by Side Diff: tests/gclient_scm_test.py

Issue 246433005: gclient: Only _DeleteOrMove if the destination directory is non-empty (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « gclient_scm.py ('k') | no next file » | 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 (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 gclient_scm.py.""" 6 """Unit tests for gclient_scm.py."""
7 7
8 # pylint: disable=E1103 8 # pylint: disable=E1103
9 9
10 # Import before super_mox to keep valid references. 10 # Import before super_mox to keep valid references.
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 def testUpdateNoDotGit(self): 1293 def testUpdateNoDotGit(self):
1294 options = self.Options() 1294 options = self.Options()
1295 1295
1296 gclient_scm.os.path.exists(self.base_path).AndReturn(True) 1296 gclient_scm.os.path.exists(self.base_path).AndReturn(True)
1297 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1297 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1298 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1298 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1299 ).AndReturn(False) 1299 ).AndReturn(False)
1300 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1300 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1301 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1301 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1302 ).AndReturn(False) 1302 ).AndReturn(False)
1303 self.mox.StubOutWithMock(gclient_scm.os, 'listdir', True)
1304 gclient_scm.os.listdir(self.base_path).AndReturn([])
1303 1305
1304 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1306 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1305 # pylint: disable=E1120 1307 # pylint: disable=E1120
1306 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, 1308 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
1307 options) 1309 options)
1308 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) 1310 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
1309 gclient_scm.subprocess2.check_output(['git', 'ls-files'], 1311 gclient_scm.subprocess2.check_output(['git', 'ls-files'],
1310 cwd=self.base_path, 1312 cwd=self.base_path,
1311 stderr=-1, 1313 stderr=-1,
1312 ).AndReturn('') 1314 ).AndReturn('')
(...skipping 12 matching lines...) Expand all
1325 def testUpdateNoDotGitForce(self): 1327 def testUpdateNoDotGitForce(self):
1326 options = self.Options(force=True) 1328 options = self.Options(force=True)
1327 1329
1328 gclient_scm.os.path.exists(self.base_path).AndReturn(True) 1330 gclient_scm.os.path.exists(self.base_path).AndReturn(True)
1329 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1331 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1330 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1332 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1331 ).AndReturn(False) 1333 ).AndReturn(False)
1332 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1334 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1333 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1335 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1334 ).AndReturn(False) 1336 ).AndReturn(False)
1337 self.mox.StubOutWithMock(gclient_scm.os, 'listdir', True)
1338 gclient_scm.os.listdir(self.base_path).AndReturn([])
1335 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1339 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1336 # pylint: disable=E1120 1340 # pylint: disable=E1120
1337 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, 1341 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
1338 options) 1342 options)
1339 # pylint: disable=E1120 1343 # pylint: disable=E1120
1340 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) 1344 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
1341 gclient_scm.subprocess2.check_output(['git', 'ls-files'], 1345 gclient_scm.subprocess2.check_output(['git', 'ls-files'],
1342 cwd=self.base_path, 1346 cwd=self.base_path,
1343 stderr=-1, 1347 stderr=-1,
1344 ).AndReturn('') 1348 ).AndReturn('')
(...skipping 29 matching lines...) Expand all
1374 1378
1375 if __name__ == '__main__': 1379 if __name__ == '__main__':
1376 if '-v' in sys.argv: 1380 if '-v' in sys.argv:
1377 logging.basicConfig( 1381 logging.basicConfig(
1378 level=logging.DEBUG, 1382 level=logging.DEBUG,
1379 format='%(asctime).19s %(levelname)s %(filename)s:' 1383 format='%(asctime).19s %(levelname)s %(filename)s:'
1380 '%(lineno)s %(message)s') 1384 '%(lineno)s %(message)s')
1381 unittest.main() 1385 unittest.main()
1382 1386
1383 # vim: ts=2:sw=2:tw=80:et: 1387 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698