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

Side by Side Diff: tests/gclient_scm_test.py

Issue 247493002: Eliminate all interactive terminal prompts from git. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: fix scm_unittest.py 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 | « scm.py ('k') | tests/scm_unittest.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 (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 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1303
1304 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1304 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1305 # pylint: disable=E1120 1305 # pylint: disable=E1120
1306 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, 1306 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
1307 options) 1307 options)
1308 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) 1308 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
1309 gclient_scm.subprocess2.check_output(['git', 'ls-files'], 1309 gclient_scm.subprocess2.check_output(
1310 cwd=self.base_path, 1310 ['git', 'ls-files'], cwd=self.base_path,
1311 stderr=-1, 1311 env=gclient_scm.scm.GIT.ApplyEnvVars({}), stderr=-1,).AndReturn('')
1312 ).AndReturn('')
1313 gclient_scm.subprocess2.check_output( 1312 gclient_scm.subprocess2.check_output(
1314 ['git', 'rev-parse', '--verify', 'HEAD'], 1313 ['git', 'rev-parse', '--verify', 'HEAD'],
1315 cwd=self.base_path, 1314 cwd=self.base_path,
1315 env=gclient_scm.scm.GIT.ApplyEnvVars({}),
1316 stderr=-1, 1316 stderr=-1,
1317 ).AndReturn('') 1317 ).AndReturn('')
1318 1318
1319 self.mox.ReplayAll() 1319 self.mox.ReplayAll()
1320 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1320 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1321 relpath=self.relpath) 1321 relpath=self.relpath)
1322 scm.update(options, None, []) 1322 scm.update(options, None, [])
1323 self.checkstdout('\n') 1323 self.checkstdout('\n')
1324 1324
1325 def testUpdateNoDotGitForce(self): 1325 def testUpdateNoDotGitForce(self):
1326 options = self.Options(force=True) 1326 options = self.Options(force=True)
1327 1327
1328 gclient_scm.os.path.exists(self.base_path).AndReturn(True) 1328 gclient_scm.os.path.exists(self.base_path).AndReturn(True)
1329 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1329 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1330 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1330 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1331 ).AndReturn(False) 1331 ).AndReturn(False)
1332 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1332 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1333 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1333 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1334 ).AndReturn(False) 1334 ).AndReturn(False)
1335 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1335 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1336 # pylint: disable=E1120 1336 # pylint: disable=E1120
1337 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, 1337 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
1338 options) 1338 options)
1339 # pylint: disable=E1120 1339 # pylint: disable=E1120
1340 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) 1340 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
1341 gclient_scm.subprocess2.check_output(['git', 'ls-files'], 1341 gclient_scm.subprocess2.check_output(
1342 cwd=self.base_path, 1342 ['git', 'ls-files'], cwd=self.base_path,
1343 stderr=-1, 1343 env=gclient_scm.scm.GIT.ApplyEnvVars({}), stderr=-1,).AndReturn('')
1344 ).AndReturn('')
1345 gclient_scm.subprocess2.check_output( 1344 gclient_scm.subprocess2.check_output(
1346 ['git', 'rev-parse', '--verify', 'HEAD'], 1345 ['git', 'rev-parse', '--verify', 'HEAD'],
1347 cwd=self.base_path, 1346 cwd=self.base_path,
1347 env=gclient_scm.scm.GIT.ApplyEnvVars({}),
1348 stderr=-1, 1348 stderr=-1,
1349 ).AndReturn('') 1349 ).AndReturn('')
1350 1350
1351 self.mox.ReplayAll() 1351 self.mox.ReplayAll()
1352 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1352 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1353 relpath=self.relpath) 1353 relpath=self.relpath)
1354 scm.update(options, None, []) 1354 scm.update(options, None, [])
1355 self.checkstdout('\n') 1355 self.checkstdout('\n')
1356 1356
1357 1357
(...skipping 16 matching lines...) Expand all
1374 1374
1375 if __name__ == '__main__': 1375 if __name__ == '__main__':
1376 if '-v' in sys.argv: 1376 if '-v' in sys.argv:
1377 logging.basicConfig( 1377 logging.basicConfig(
1378 level=logging.DEBUG, 1378 level=logging.DEBUG,
1379 format='%(asctime).19s %(levelname)s %(filename)s:' 1379 format='%(asctime).19s %(levelname)s %(filename)s:'
1380 '%(lineno)s %(message)s') 1380 '%(lineno)s %(message)s')
1381 unittest.main() 1381 unittest.main()
1382 1382
1383 # vim: ts=2:sw=2:tw=80:et: 1383 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « scm.py ('k') | tests/scm_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698