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

Side by Side Diff: tests/checkout_test.py

Issue 25686005: Return unicode commit hashes in checkout.GitCheckout (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « checkout.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 checkout.py.""" 6 """Unit tests for checkout.py."""
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return data 277 return data
278 278
279 def _check_base(self, co, root, expected): 279 def _check_base(self, co, root, expected):
280 read_only = isinstance(co, checkout.ReadOnlyCheckout) 280 read_only = isinstance(co, checkout.ReadOnlyCheckout)
281 self.assertEquals(not read_only, bool(expected)) 281 self.assertEquals(not read_only, bool(expected))
282 self.assertEquals(read_only, self.is_read_only) 282 self.assertEquals(read_only, self.is_read_only)
283 if not read_only: 283 if not read_only:
284 self.FAKE_REPOS.svn_dirty = True 284 self.FAKE_REPOS.svn_dirty = True
285 285
286 self.assertEquals(root, co.project_path) 286 self.assertEquals(root, co.project_path)
287 self.assertEquals(self.previous_log['revision'], co.prepare(None)) 287 svn_rev = co.prepare(None)
288 self.assertEquals(int, type(svn_rev))
289 self.assertEquals(self.previous_log['revision'], svn_rev)
288 self.assertEquals('pouet', co.get_settings('bar')) 290 self.assertEquals('pouet', co.get_settings('bar'))
289 self.assertTree(self.get_trunk(False), root) 291 self.assertTree(self.get_trunk(False), root)
290 patches = self.get_patches() 292 patches = self.get_patches()
291 co.apply_patch(patches) 293 co.apply_patch(patches)
292 self.assertEquals( 294 self.assertEquals(
293 ['bin_file', 'chrome/file.cc', 'new_dir/subdir/new_file', 'extra'], 295 ['bin_file', 'chrome/file.cc', 'new_dir/subdir/new_file', 'extra'],
294 patches.filenames) 296 patches.filenames)
295 297
296 # Verify that the patch is applied even for read only checkout. 298 # Verify that the patch is applied even for read only checkout.
297 self.assertTree(self.get_trunk(True), root) 299 self.assertTree(self.get_trunk(True), root)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 'msg': out.split()[-1], 372 'msg': out.split()[-1],
371 } 373 }
372 374
373 def _check_base(self, co, root, expected): 375 def _check_base(self, co, root, expected):
374 read_only = isinstance(co, checkout.ReadOnlyCheckout) 376 read_only = isinstance(co, checkout.ReadOnlyCheckout)
375 self.assertEquals(read_only, self.is_read_only) 377 self.assertEquals(read_only, self.is_read_only)
376 if not read_only: 378 if not read_only:
377 self.FAKE_REPOS.git_dirty = True 379 self.FAKE_REPOS.git_dirty = True
378 380
379 self.assertEquals(root, co.project_path) 381 self.assertEquals(root, co.project_path)
380 self.assertEquals(self.previous_log['revision'], co.prepare(None)) 382 git_rev = co.prepare(None)
383 self.assertEquals(unicode, type(git_rev))
iannucci 2013/10/02 18:24:36 hmm... can't we just change the expected return ty
rmistry 2013/10/02 19:02:13 We can, it will need a few changes in the CQ. Sinc
384 self.assertEquals(self.previous_log['revision'], git_rev)
381 self.assertEquals('pouet', co.get_settings('bar')) 385 self.assertEquals('pouet', co.get_settings('bar'))
382 self.assertTree(self.get_trunk(False), root) 386 self.assertTree(self.get_trunk(False), root)
383 patches = self.get_patches() 387 patches = self.get_patches()
384 co.apply_patch(patches) 388 co.apply_patch(patches)
385 self.assertEquals( 389 self.assertEquals(
386 ['bin_file', 'chrome/file.cc', 'new_dir/subdir/new_file', 'extra'], 390 ['bin_file', 'chrome/file.cc', 'new_dir/subdir/new_file', 'extra'],
387 patches.filenames) 391 patches.filenames)
388 392
389 # Hackish to verify _branches() internal function. 393 # Hackish to verify _branches() internal function.
390 # pylint: disable=W0212 394 # pylint: disable=W0212
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 if '-v' in sys.argv: 728 if '-v' in sys.argv:
725 DEBUGGING = True 729 DEBUGGING = True
726 logging.basicConfig( 730 logging.basicConfig(
727 level=logging.DEBUG, 731 level=logging.DEBUG,
728 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') 732 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')
729 else: 733 else:
730 logging.basicConfig( 734 logging.basicConfig(
731 level=logging.ERROR, 735 level=logging.ERROR,
732 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') 736 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s')
733 unittest.main() 737 unittest.main()
OLDNEW
« no previous file with comments | « checkout.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698