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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 | 491 |
492 # Verify no locked files. | 492 # Verify no locked files. |
493 dotted_path = join(self.base_path, '.') | 493 dotted_path = join(self.base_path, '.') |
494 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) | 494 gclient_scm.scm.SVN.CaptureStatus(None, dotted_path).AndReturn([]) |
495 | 495 |
496 # 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. |
497 files_list = self.mox.CreateMockAnything() | 497 files_list = self.mox.CreateMockAnything() |
498 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 498 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
499 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 499 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
500 always=True, | 500 always=True, |
501 nag_max=3, | 501 nag_max=6, |
502 nag_timer=30, | 502 nag_timer=30, |
503 cwd=self.root_dir) | 503 cwd=self.root_dir) |
504 gclient_scm.scm.SVN.RunAndGetFileList( | 504 gclient_scm.scm.SVN.RunAndGetFileList( |
505 options.verbose, | 505 options.verbose, |
506 ['update', 'DEPS', '--ignore-externals'], | 506 ['update', 'DEPS', '--ignore-externals'], |
507 cwd=self.base_path, | 507 cwd=self.base_path, |
508 file_list=files_list) | 508 file_list=files_list) |
509 | 509 |
510 # Now we fall back on scm.update(). | 510 # Now we fall back on scm.update(). |
511 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) |
(...skipping 15 matching lines...) Expand all Loading... |
527 # Checks to make sure that we support svn co --depth. | 527 # Checks to make sure that we support svn co --depth. |
528 gclient_scm.scm.SVN.current_version = None | 528 gclient_scm.scm.SVN.current_version = None |
529 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None | 529 gclient_scm.scm.SVN.Capture(['--version', '--quiet'], None |
530 ).AndReturn('1.4.4') | 530 ).AndReturn('1.4.4') |
531 gclient_scm.os.path.exists(self.base_path).AndReturn(True) | 531 gclient_scm.os.path.exists(self.base_path).AndReturn(True) |
532 | 532 |
533 # 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 |
534 files_list = self.mox.CreateMockAnything() | 534 files_list = self.mox.CreateMockAnything() |
535 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 535 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
536 ['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')], | 536 ['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')], |
537 nag_timer=30, nag_max=3, always=True, cwd=self.root_dir) | 537 nag_timer=30, nag_max=6, always=True, cwd=self.root_dir) |
538 | 538 |
539 self.mox.ReplayAll() | 539 self.mox.ReplayAll() |
540 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, |
541 relpath=self.relpath) | 541 relpath=self.relpath) |
542 scm.updatesingle(options, ['DEPS'], files_list) | 542 scm.updatesingle(options, ['DEPS'], files_list) |
543 | 543 |
544 def testUpdateSingleCheckoutSVNUpgrade(self): | 544 def testUpdateSingleCheckoutSVNUpgrade(self): |
545 options = self.Options(verbose=True) | 545 options = self.Options(verbose=True) |
546 file_info = { | 546 file_info = { |
547 'URL': self.url, | 547 'URL': self.url, |
(...skipping 12 matching lines...) Expand all Loading... |
560 | 560 |
561 # Verify no locked files. | 561 # Verify no locked files. |
562 gclient_scm.scm.SVN.CaptureStatus( | 562 gclient_scm.scm.SVN.CaptureStatus( |
563 None, join(self.base_path, '.')).AndReturn([]) | 563 None, join(self.base_path, '.')).AndReturn([]) |
564 | 564 |
565 # 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. |
566 files_list = self.mox.CreateMockAnything() | 566 files_list = self.mox.CreateMockAnything() |
567 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( | 567 gclient_scm.gclient_utils.CheckCallAndFilterAndHeader( |
568 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], | 568 ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path], |
569 always=True, | 569 always=True, |
570 nag_max=3, | 570 nag_max=6, |
571 nag_timer=30, | 571 nag_timer=30, |
572 cwd=self.root_dir) | 572 cwd=self.root_dir) |
573 gclient_scm.scm.SVN.RunAndGetFileList( | 573 gclient_scm.scm.SVN.RunAndGetFileList( |
574 options.verbose, | 574 options.verbose, |
575 ['update', 'DEPS', '--ignore-externals'], | 575 ['update', 'DEPS', '--ignore-externals'], |
576 cwd=self.base_path, | 576 cwd=self.base_path, |
577 file_list=files_list) | 577 file_list=files_list) |
578 | 578 |
579 # Now we fall back on scm.update(). | 579 # Now we fall back on scm.update(). |
580 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) |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 | 1189 |
1190 if __name__ == '__main__': | 1190 if __name__ == '__main__': |
1191 if '-v' in sys.argv: | 1191 if '-v' in sys.argv: |
1192 logging.basicConfig( | 1192 logging.basicConfig( |
1193 level=logging.DEBUG, | 1193 level=logging.DEBUG, |
1194 format='%(asctime).19s %(levelname)s %(filename)s:' | 1194 format='%(asctime).19s %(levelname)s %(filename)s:' |
1195 '%(lineno)s %(message)s') | 1195 '%(lineno)s %(message)s') |
1196 unittest.main() | 1196 unittest.main() |
1197 | 1197 |
1198 # vim: ts=2:sw=2:tw=80:et: | 1198 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |