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