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

Side by Side Diff: tests/gclient_scm_test.py

Issue 348703002: Remove hooks until Windows performance issues are sorted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 6 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 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 self.assertEquals(git_svn_scm.GetUsableRev(self.fake_hash_1, options), 1315 self.assertEquals(git_svn_scm.GetUsableRev(self.fake_hash_1, options),
1316 self.fake_hash_1) 1316 self.fake_hash_1)
1317 # We currently check for seemingly valid SVN revisions by assuming 6 digit 1317 # We currently check for seemingly valid SVN revisions by assuming 6 digit
1318 # numbers, so assure that numeric revs >= 1000000 don't work. 1318 # numbers, so assure that numeric revs >= 1000000 don't work.
1319 self.assertRaises(gclient_scm.gclient_utils.Error, 1319 self.assertRaises(gclient_scm.gclient_utils.Error,
1320 git_svn_scm.GetUsableRev, too_big, options) 1320 git_svn_scm.GetUsableRev, too_big, options)
1321 1321
1322 def testUpdateNoDotGit(self): 1322 def testUpdateNoDotGit(self):
1323 options = self.Options() 1323 options = self.Options()
1324 1324
1325 gclient_scm.os.path.isdir(
1326 os.path.join(self.base_path, '.git', 'hooks')).AndReturn(False)
1325 gclient_scm.os.path.exists(self.base_path).AndReturn(True) 1327 gclient_scm.os.path.exists(self.base_path).AndReturn(True)
1326 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1328 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1327 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1329 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1328 ).AndReturn(False) 1330 ).AndReturn(False)
1329 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1331 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1330 # pylint: disable=E1120 1332 # pylint: disable=E1120
1331 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url, 1333 gclient_scm.GitWrapper._Clone('refs/remotes/origin/master', self.url,
1332 options) 1334 options)
1333 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True) 1335 self.mox.StubOutWithMock(gclient_scm.subprocess2, 'check_output', True)
1334 gclient_scm.subprocess2.check_output( 1336 gclient_scm.subprocess2.check_output(
1335 ['git', 'ls-files'], cwd=self.base_path, 1337 ['git', 'ls-files'], cwd=self.base_path,
1336 env=gclient_scm.scm.GIT.ApplyEnvVars({}), stderr=-1,).AndReturn('') 1338 env=gclient_scm.scm.GIT.ApplyEnvVars({}), stderr=-1,).AndReturn('')
1337 gclient_scm.subprocess2.check_output( 1339 gclient_scm.subprocess2.check_output(
1338 ['git', 'rev-parse', '--verify', 'HEAD'], 1340 ['git', 'rev-parse', '--verify', 'HEAD'],
1339 cwd=self.base_path, 1341 cwd=self.base_path,
1340 env=gclient_scm.scm.GIT.ApplyEnvVars({}), 1342 env=gclient_scm.scm.GIT.ApplyEnvVars({}),
1341 stderr=-1, 1343 stderr=-1,
1342 ).AndReturn('') 1344 ).AndReturn('')
1343 1345
1344 self.mox.ReplayAll() 1346 self.mox.ReplayAll()
1345 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, 1347 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
1346 relpath=self.relpath) 1348 relpath=self.relpath)
1347 scm.update(options, None, []) 1349 scm.update(options, None, [])
1348 self.checkstdout('\n') 1350 self.checkstdout('\n')
1349 1351
1350 def testUpdateConflict(self): 1352 def testUpdateConflict(self):
1351 options = self.Options() 1353 options = self.Options()
1352 1354
1355 gclient_scm.os.path.isdir(
1356 os.path.join(self.base_path, '.git', 'hooks')).AndReturn(False)
1353 gclient_scm.os.path.exists(self.base_path).AndReturn(True) 1357 gclient_scm.os.path.exists(self.base_path).AndReturn(True)
1354 gclient_scm.os.path.isdir(self.base_path).AndReturn(True) 1358 gclient_scm.os.path.isdir(self.base_path).AndReturn(True)
1355 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git') 1359 gclient_scm.os.path.exists(os.path.join(self.base_path, '.git')
1356 ).AndReturn(False) 1360 ).AndReturn(False)
1357 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True) 1361 self.mox.StubOutWithMock(gclient_scm.GitWrapper, '_Clone', True)
1358 # pylint: disable=E1120 1362 # pylint: disable=E1120
1359 gclient_scm.GitWrapper._Clone( 1363 gclient_scm.GitWrapper._Clone(
1360 'refs/remotes/origin/master', self.url, options 1364 'refs/remotes/origin/master', self.url, options
1361 ).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None, 1365 ).AndRaise(gclient_scm.subprocess2.CalledProcessError(None, None, None,
1362 None, None)) 1366 None, None))
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 1580
1577 if __name__ == '__main__': 1581 if __name__ == '__main__':
1578 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL 1582 level = logging.DEBUG if '-v' in sys.argv else logging.FATAL
1579 logging.basicConfig( 1583 logging.basicConfig(
1580 level=level, 1584 level=level,
1581 format='%(asctime).19s %(levelname)s %(filename)s:' 1585 format='%(asctime).19s %(levelname)s %(filename)s:'
1582 '%(lineno)s %(message)s') 1586 '%(lineno)s %(message)s')
1583 unittest.main() 1587 unittest.main()
1584 1588
1585 # vim: ts=2:sw=2:tw=80:et: 1589 # 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