| 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 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 expected = { | 300 expected = { |
| 301 'author': self.FAKE_REPOS.USERS[0][0], | 301 'author': self.FAKE_REPOS.USERS[0][0], |
| 302 'revprops': [('realauthor', self.FAKE_REPOS.USERS[1][0])] | 302 'revprops': [('realauthor', self.FAKE_REPOS.USERS[1][0])] |
| 303 } | 303 } |
| 304 root = os.path.join(self.root_dir, self.name) | 304 root = os.path.join(self.root_dir, self.name) |
| 305 self._check_base(self._get_co(None), root, False, expected) | 305 self._check_base(self._get_co(None), root, False, expected) |
| 306 | 306 |
| 307 def testException(self): | 307 def testException(self): |
| 308 self._check_exception( | 308 self._check_exception( |
| 309 self._get_co(None), | 309 self._get_co(None), |
| 310 'While running patch -p1 --forward --force;\n' | 310 'While running patch -p1 --forward --force --no-backup-if-mismatch;\n' |
| 311 'patching file chrome/file.cc\n' | 311 'patching file chrome/file.cc\n' |
| 312 'Hunk #1 FAILED at 3.\n' | 312 'Hunk #1 FAILED at 3.\n' |
| 313 '1 out of 1 hunk FAILED -- saving rejects to file ' | 313 '1 out of 1 hunk FAILED -- saving rejects to file ' |
| 314 'chrome/file.cc.rej\n') | 314 'chrome/file.cc.rej\n') |
| 315 | 315 |
| 316 def testSvnProps(self): | 316 def testSvnProps(self): |
| 317 co = self._get_co(None) | 317 co = self._get_co(None) |
| 318 co.prepare(None) | 318 co.prepare(None) |
| 319 try: | 319 try: |
| 320 # svn:ignore can only be applied to directories. | 320 # svn:ignore can only be applied to directories. |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 self.root_dir, self.name, None, None, self.svn_url, None), | 506 self.root_dir, self.name, None, None, self.svn_url, None), |
| 507 post_processors) | 507 post_processors) |
| 508 | 508 |
| 509 def testAll(self): | 509 def testAll(self): |
| 510 root = os.path.join(self.root_dir, self.name) | 510 root = os.path.join(self.root_dir, self.name) |
| 511 self._check_base(self._get_co(None), root, False, None) | 511 self._check_base(self._get_co(None), root, False, None) |
| 512 | 512 |
| 513 def testException(self): | 513 def testException(self): |
| 514 self._check_exception( | 514 self._check_exception( |
| 515 self._get_co(None), | 515 self._get_co(None), |
| 516 'While running patch -p1 --forward --force;\n' | 516 'While running patch -p1 --forward --force --no-backup-if-mismatch;\n' |
| 517 'patching file chrome/file.cc\n' | 517 'patching file chrome/file.cc\n' |
| 518 'Hunk #1 FAILED at 3.\n' | 518 'Hunk #1 FAILED at 3.\n' |
| 519 '1 out of 1 hunk FAILED -- saving rejects to file ' | 519 '1 out of 1 hunk FAILED -- saving rejects to file ' |
| 520 'chrome/file.cc.rej\n') | 520 'chrome/file.cc.rej\n') |
| 521 | 521 |
| 522 def testProcess(self): | 522 def testProcess(self): |
| 523 self._test_process(self._get_co) | 523 self._test_process(self._get_co) |
| 524 | 524 |
| 525 def testPrepare(self): | 525 def testPrepare(self): |
| 526 self._test_prepare(self._get_co(None)) | 526 self._test_prepare(self._get_co(None)) |
| 527 | 527 |
| 528 def testMove(self): | 528 def testMove(self): |
| 529 self._check_move(self._get_co(None)) | 529 self._check_move(self._get_co(None)) |
| 530 | 530 |
| 531 | 531 |
| 532 if __name__ == '__main__': | 532 if __name__ == '__main__': |
| 533 if '-v' in sys.argv: | 533 if '-v' in sys.argv: |
| 534 DEBUGGING = True | 534 DEBUGGING = True |
| 535 logging.basicConfig( | 535 logging.basicConfig( |
| 536 level=logging.DEBUG, | 536 level=logging.DEBUG, |
| 537 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 537 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
| 538 else: | 538 else: |
| 539 logging.basicConfig( | 539 logging.basicConfig( |
| 540 level=logging.ERROR, | 540 level=logging.ERROR, |
| 541 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') | 541 format='%(levelname)5s %(filename)15s(%(lineno)3d): %(message)s') |
| 542 unittest.main() | 542 unittest.main() |
| OLD | NEW |