~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/repository_implementations/test_commit_builder.py

  • Committer: Vincent Ladeuil
  • Date: 2007-09-20 09:30:39 UTC
  • mto: (2837.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 2838.
  • Revision ID: v.ladeuil+lp@free.fr-20070920093039-xnjzgav92o44ient
Review feedback.

* bzrlib/tests/repository_implementations/test_commit_builder.py:
(TestCommitBuilder._check_kind_change.change_kind): Use
osutils.delete_any.

* bzrlib/osutils.py:
(delete_any): Rewritten for portability.

Show diffs side-by-side

added added

removed removed

Lines of Context:
420
420
        tree = self.make_branch_and_tree('.')
421
421
        path = 'name'
422
422
        make_before(path)
 
423
 
423
424
        def change_kind():
424
 
            # Look Before You Leap (LBYL) is appropriate here because unlink
425
 
            # will raise different exceptions on different OSes (linux: EISDIR,
426
 
            # win32: EACCES, OSX: EPERM) when invoked on a directory.
427
 
            if osutils.isdir(path): # Takes care of symlinks
428
 
                os.rmdir(path)
429
 
            else:
430
 
                os.unlink(path)
 
425
            osutils.delete_any(path)
431
426
            make_after(path)
 
427
 
432
428
        self._add_commit_change_check_changed(tree, path, change_kind)
433
429
 
434
430
    def test_last_modified_dir_file(self):