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

Side by Side Diff: tests/gclient_scm_test.py

Issue 3473004: Remove unneeded parameter. (Closed)
Patch Set: Created 10 years, 3 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
« no previous file with comments | « no previous file | 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 # Import before super_mox to keep valid references. 8 # Import before super_mox to keep valid references.
9 from os import rename 9 from os import rename
10 from shutil import rmtree 10 from shutil import rmtree
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'RunAndGetFileList') 49 self.mox.StubOutWithMock(gclient_scm.scm.SVN, 'RunAndGetFileList')
50 self._scm_wrapper = gclient_scm.CreateSCM 50 self._scm_wrapper = gclient_scm.CreateSCM
51 gclient_scm.scm.SVN.current_version = None 51 gclient_scm.scm.SVN.current_version = None
52 52
53 def tearDown(self): 53 def tearDown(self):
54 SuperMoxTestBase.tearDown(self) 54 SuperMoxTestBase.tearDown(self)
55 55
56 56
57 class SVNWrapperTestCase(BaseTestCase): 57 class SVNWrapperTestCase(BaseTestCase):
58 class OptionsObject(object): 58 class OptionsObject(object):
59 def __init__(self, test_case, verbose=False, revision=None): 59 def __init__(self, verbose=False, revision=None):
60 self.verbose = verbose 60 self.verbose = verbose
61 self.revision = revision 61 self.revision = revision
62 self.manually_grab_svn_rev = True 62 self.manually_grab_svn_rev = True
63 self.deps_os = None 63 self.deps_os = None
64 self.force = False 64 self.force = False
65 self.reset = False 65 self.reset = False
66 self.nohooks = False 66 self.nohooks = False
67 self.stdout = gclient_scm.sys.stdout 67 self.stdout = gclient_scm.sys.stdout
68 68
69 def Options(self, *args, **kwargs): 69 def Options(self, *args, **kwargs):
70 return self.OptionsObject(self, *args, **kwargs) 70 return self.OptionsObject(*args, **kwargs)
71 71
72 def setUp(self): 72 def setUp(self):
73 BaseTestCase.setUp(self) 73 BaseTestCase.setUp(self)
74 self.url = self.SvnUrl() 74 self.url = self.SvnUrl()
75 75
76 def testDir(self): 76 def testDir(self):
77 members = [ 77 members = [
78 'FullUrlForRelativeUrl', 'RunCommand', 78 'FullUrlForRelativeUrl', 'RunCommand',
79 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', 79 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert',
80 'revinfo', 'runhooks', 'status', 'update', 80 'revinfo', 'runhooks', 'status', 'update',
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 file_list = [] 469 file_list = []
470 scm.update(options, self.args, file_list) 470 scm.update(options, self.args, file_list)
471 self.checkstdout( 471 self.checkstdout(
472 ('________ found .git directory; skipping %s\n' % self.relpath)) 472 ('________ found .git directory; skipping %s\n' % self.relpath))
473 473
474 474
475 class GitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils, 475 class GitWrapperTestCase(GCBaseTestCase, StdoutCheck, TestCaseUtils,
476 unittest.TestCase): 476 unittest.TestCase):
477 """This class doesn't use pymox.""" 477 """This class doesn't use pymox."""
478 class OptionsObject(object): 478 class OptionsObject(object):
479 def __init__(self, test_case, verbose=False, revision=None): 479 def __init__(self, verbose=False, revision=None):
480 self.verbose = verbose 480 self.verbose = verbose
481 self.revision = revision 481 self.revision = revision
482 self.manually_grab_svn_rev = True 482 self.manually_grab_svn_rev = True
483 self.deps_os = None 483 self.deps_os = None
484 self.force = False 484 self.force = False
485 self.reset = False 485 self.reset = False
486 self.nohooks = False 486 self.nohooks = False
487 self.stdout = gclient_scm.sys.stdout 487 self.stdout = gclient_scm.sys.stdout
488 488
489 sample_git_import = """blob 489 sample_git_import = """blob
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 data 13 525 data 13
526 Personalized 526 Personalized
527 from :3 527 from :3
528 M 100644 :4 a 528 M 100644 :4 a
529 M 100644 :5 b 529 M 100644 :5 b
530 530
531 reset refs/heads/master 531 reset refs/heads/master
532 from :3 532 from :3
533 """ 533 """
534 def Options(self, *args, **kwargs): 534 def Options(self, *args, **kwargs):
535 return self.OptionsObject(self, *args, **kwargs) 535 return self.OptionsObject(*args, **kwargs)
536 536
537 def CreateGitRepo(self, git_import, path): 537 def CreateGitRepo(self, git_import, path):
538 """Do it for real.""" 538 """Do it for real."""
539 try: 539 try:
540 Popen(['git', 'init', '-q'], stdout=PIPE, stderr=STDOUT, 540 Popen(['git', 'init', '-q'], stdout=PIPE, stderr=STDOUT,
541 cwd=path).communicate() 541 cwd=path).communicate()
542 except OSError: 542 except OSError:
543 # git is not available, skip this test. 543 # git is not available, skip this test.
544 return False 544 return False
545 Popen(['git', 'fast-import', '--quiet'], stdin=PIPE, stdout=PIPE, 545 Popen(['git', 'fast-import', '--quiet'], stdin=PIPE, stdout=PIPE,
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir, 833 scm = gclient_scm.CreateSCM(url=self.url, root_dir=self.root_dir,
834 relpath=self.relpath) 834 relpath=self.relpath)
835 rev_info = scm.revinfo(options, (), None) 835 rev_info = scm.revinfo(options, (), None)
836 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') 836 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458')
837 837
838 838
839 if __name__ == '__main__': 839 if __name__ == '__main__':
840 unittest.main() 840 unittest.main()
841 841
842 # vim: ts=2:sw=2:tw=80:et: 842 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698