Chromium Code Reviews| 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 scm.py.""" | 6 """Unit tests for scm.py.""" |
| 7 | 7 |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 501 added_and_removed = join('added_and_removed') | 501 added_and_removed = join('added_and_removed') |
| 502 with open(added_and_removed, 'w') as f: | 502 with open(added_and_removed, 'w') as f: |
| 503 f.write('oh') | 503 f.write('oh') |
| 504 self._capture(['add', added_and_removed]) | 504 self._capture(['add', added_and_removed]) |
| 505 scm.os.remove(added_and_removed) | 505 scm.os.remove(added_and_removed) |
| 506 # Make sure a tree of directories can be removed. | 506 # Make sure a tree of directories can be removed. |
| 507 scm.os.makedirs(join('new_dir', 'subdir')) | 507 scm.os.makedirs(join('new_dir', 'subdir')) |
| 508 with open(join('new_dir', 'subdir', 'newfile'), 'w') as f: | 508 with open(join('new_dir', 'subdir', 'newfile'), 'w') as f: |
| 509 f.write('ah!') | 509 f.write('ah!') |
| 510 self._capture(['add', join('new_dir')]) | 510 self._capture(['add', join('new_dir')]) |
| 511 self._capture(['add', join('new_dir', 'subdir')]) | 511 #self._capture(['add', join('new_dir', 'subdir')]) |
| 512 self._capture(['add', join('new_dir', 'subdir', 'newfile')]) | 512 #self._capture(['add', join('new_dir', 'subdir', 'newfile')]) |
|
Sam Clegg
2014/12/10 21:25:38
I was getting svn errors here, presumably because
M-A Ruel
2014/12/11 01:22:46
Ok, it wasn't previously.
| |
| 513 # A random file in an added directory confuses svn. | 513 # A random file in an added directory confuses svn. |
| 514 scm.os.makedirs(join('new_dir2', 'subdir')) | 514 scm.os.makedirs(join('new_dir2', 'subdir')) |
| 515 with open(join('new_dir2', 'subdir', 'newfile'), 'w') as f: | 515 with open(join('new_dir2', 'subdir', 'newfile'), 'w') as f: |
| 516 f.write('ah!') | 516 f.write('ah!') |
| 517 self._capture(['add', join('new_dir2')]) | 517 self._capture(['add', join('new_dir2')]) |
| 518 self._capture(['add', join('new_dir2', 'subdir')]) | 518 #self._capture(['add', join('new_dir2', 'subdir')]) |
| 519 self._capture(['add', join('new_dir2', 'subdir', 'newfile')]) | 519 #self._capture(['add', join('new_dir2', 'subdir', 'newfile')]) |
| 520 with open(join('new_dir2', 'subdir', 'unversionedfile'), 'w') as f: | 520 with open(join('new_dir2', 'subdir', 'unversionedfile'), 'w') as f: |
| 521 f.write('unadded file!') | 521 f.write('unadded file!') |
| 522 | 522 |
| 523 scm.SVN.Revert(self.svn_root) | 523 scm.SVN.Revert(self.svn_root) |
| 524 self._capture(['update', '--revision', 'base']) | 524 self._capture(['update', '--revision', 'base']) |
| 525 | 525 |
| 526 self.assertTree(self.tree, self.svn_root) | 526 # TODO(sbc): find out why this is failing |
| 527 #self.assertTree(self.tree, self.svn_root) | |
| 528 | |
| 527 # Asserting the tree is not sufficient, svn status must come out clear too. | 529 # Asserting the tree is not sufficient, svn status must come out clear too. |
| 528 self.assertEquals('', self._capture(['status'])) | 530 #self.assertEquals('', self._capture(['status'])) |
|
Sam Clegg
2014/12/10 21:25:38
I couldn't figure this one out.
M-A Ruel
2014/12/11 01:22:46
np
Sam Clegg
2014/12/11 01:28:45
Should I disable this test then? Or delete it? M
M-A Ruel
2014/12/11 01:57:00
Delete.
Sam Clegg
2014/12/11 02:24:25
Done.
| |
| 529 | 531 |
| 530 | 532 |
| 531 if __name__ == '__main__': | 533 if __name__ == '__main__': |
| 532 if '-v' in sys.argv: | 534 if '-v' in sys.argv: |
| 533 logging.basicConfig(level=logging.DEBUG) | 535 logging.basicConfig(level=logging.DEBUG) |
| 534 unittest.main() | 536 unittest.main() |
| 535 | 537 |
| 536 # vim: ts=2:sw=2:tw=80:et: | 538 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |