OLD | NEW |
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 def testDir(self): | 101 def testDir(self): |
102 members = [ | 102 members = [ |
103 'BinaryExists', | 103 'BinaryExists', |
104 'FullUrlForRelativeUrl', | 104 'FullUrlForRelativeUrl', |
105 'GetRevisionDate', | 105 'GetRevisionDate', |
106 'GetUsableRev', | 106 'GetUsableRev', |
107 'RunCommand', | 107 'RunCommand', |
108 'cleanup', | 108 'cleanup', |
109 'diff', | 109 'diff', |
| 110 'nag_max', |
| 111 'nag_timer', |
110 'pack', | 112 'pack', |
111 'relpath', | 113 'relpath', |
112 'revert', | 114 'revert', |
113 'revinfo', | 115 'revinfo', |
114 'runhooks', | 116 'runhooks', |
115 'status', | 117 'status', |
116 'update', | 118 'update', |
117 'updatesingle', | 119 'updatesingle', |
118 'url', | 120 'url', |
119 ] | 121 ] |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 | 491 |
490 # Verify no locked files. | 492 # Verify no locked files. |
491 dotted_path = join(self.base_path, '.') | 493 dotted_path = join(self.base_path, '.') |
492 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) | 494 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) |
493 | 495 |
494 # When checking out a single file, we issue an svn checkout and svn update. | 496 # When checking out a single file, we issue an svn checkout and svn update. |
495 files_list = self.mox.CreateMockAnything() | 497 files_list = self.mox.CreateMockAnything() |
496 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 498 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
497 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 499 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
498 always=True, | 500 always=True, |
| 501 nag_max=3, |
| 502 nag_timer=30, |
499 cwd=self.root_dir) | 503 cwd=self.root_dir) |
500 gclient_scm.scm.SVN.RunAndGetFileList( | 504 gclient_scm.scm.SVN.RunAndGetFileList( |
501 options.verbose, | 505 options.verbose, |
502 ['update', 'DEPS', '--ignore-externals'], | 506 ['update', 'DEPS', '--ignore-externals'], |
503 cwd=self.base_path, | 507 cwd=self.base_path, |
504 file_list=files_list) | 508 file_list=files_list) |
505 | 509 |
506 # Now we fall back on scm.update(). | 510 # Now we fall back on scm.update(). |
507 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) | 511 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) |
508 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 512 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
(...skipping 14 matching lines...) Expand all Loading... |
523 # Checks to make sure that we support svn co --depth. | 527 # Checks to make sure that we support svn co --depth. |
524 gclient_scm.scm.SVN.current_version = None | 528 gclient_scm.scm.SVN.current_version = None |
525 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 529 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
526 ).AndReturn('1.4.4') | 530 ).AndReturn('1.4.4') |
527 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 531 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
528 | 532 |
529 # When checking out a single file with svn 1.4, we use svn export | 533 # When checking out a single file with svn 1.4, we use svn export |
530 files_list = self.mox.CreateMockAnything() | 534 files_list = self.mox.CreateMockAnything() |
531 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 535 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
532 ['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')], | 536 ['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')], |
533 always=True, cwd=self.root_dir) | 537 nag_timer=30, nag_max=3, always=True, cwd=self.root_dir) |
534 | 538 |
535 self.mox.ReplayAll() | 539 self.mox.ReplayAll() |
536 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 540 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
537 relpath=self.relpath) | 541 relpath=self.relpath) |
538 scm.updatesingle(options, ['DEPS'], files_list) | 542 scm.updatesingle(options, ['DEPS'], files_list) |
539 | 543 |
540 def testUpdateSingleCheckoutSVNUpgrade(self): | 544 def testUpdateSingleCheckoutSVNUpgrade(self): |
541 options = self.Options(verbose=True) | 545 options = self.Options(verbose=True) |
542 file_info = { | 546 file_info = { |
543 'URL': self.url, | 547 'URL': self.url, |
(...skipping 12 matching lines...) Expand all Loading... |
556 | 560 |
557 # Verify no locked files. | 561 # Verify no locked files. |
558 gclient_scm.scm.SVN.CaptureStatus( | 562 gclient_scm.scm.SVN.CaptureStatus( |
559 None, join(self.base_path, '.')).AndReturn([]) | 563 None, join(self.base_path, '.')).AndReturn([]) |
560 | 564 |
561 # When checking out a single file, we issue an svn checkout and svn update. | 565 # When checking out a single file, we issue an svn checkout and svn update. |
562 files_list = self.mox.CreateMockAnything() | 566 files_list = self.mox.CreateMockAnything() |
563 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 567 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
564 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 568 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
565 always=True, | 569 always=True, |
| 570 nag_max=3, |
| 571 nag_timer=30, |
566 cwd=self.root_dir) | 572 cwd=self.root_dir) |
567 gclient_scm.scm.SVN.RunAndGetFileList( | 573 gclient_scm.scm.SVN.RunAndGetFileList( |
568 options.verbose, | 574 options.verbose, |
569 ['update', 'DEPS', '--ignore-externals'], | 575 ['update', 'DEPS', '--ignore-externals'], |
570 cwd=self.base_path, | 576 cwd=self.base_path, |
571 file_list=files_list) | 577 file_list=files_list) |
572 | 578 |
573 # Now we fall back on scm.update(). | 579 # Now we fall back on scm.update(). |
574 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) | 580 gclient_scm.os.path.exists(join(self.base_path, '.git')).AndReturn(False) |
575 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) | 581 gclient_scm.os.path.exists(join(self.base_path, '.hg')).AndReturn(False) |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): | 786 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): |
781 def testDir(self): | 787 def testDir(self): |
782 members = [ | 788 members = [ |
783 'BinaryExists', | 789 'BinaryExists', |
784 'FullUrlForRelativeUrl', | 790 'FullUrlForRelativeUrl', |
785 'GetRevisionDate', | 791 'GetRevisionDate', |
786 'GetUsableRev', | 792 'GetUsableRev', |
787 'RunCommand', | 793 'RunCommand', |
788 'cleanup', | 794 'cleanup', |
789 'diff', | 795 'diff', |
| 796 'nag_max', |
| 797 'nag_timer', |
790 'pack', | 798 'pack', |
791 'UpdateSubmoduleConfig', | 799 'UpdateSubmoduleConfig', |
792 'relpath', | 800 'relpath', |
793 'revert', | 801 'revert', |
794 'revinfo', | 802 'revinfo', |
795 'runhooks', | 803 'runhooks', |
796 'status', | 804 'status', |
797 'update', | 805 'update', |
798 'url', | 806 'url', |
799 ] | 807 ] |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 | 1189 |
1182 if __name__ == '__main__': | 1190 if __name__ == '__main__': |
1183 if '-v' in sys.argv: | 1191 if '-v' in sys.argv: |
1184 logging.basicConfig( | 1192 logging.basicConfig( |
1185 level=logging.DEBUG, | 1193 level=logging.DEBUG, |
1186 format='%(asctime).19s %(levelname)s %(filename)s:' | 1194 format='%(asctime).19s %(levelname)s %(filename)s:' |
1187 '%(lineno)s %(message)s') | 1195 '%(lineno)s %(message)s') |
1188 unittest.main() | 1196 unittest.main() |
1189 | 1197 |
1190 # vim: ts=2:sw=2:tw=80:et: | 1198 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |