~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Aaron Bentley
  • Date: 2007-04-16 15:38:10 UTC
  • mto: (1551.19.24 Aaron's mergeable stuff)
  • mto: This revision was merged to the branch mainline in revision 2423.
  • Revision ID: abentley@panoramicfeedback.com-20070416153810-llz9qggakjio05ku
FTP does not require atomic rename. Fixes #89436

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
 
72
72
        self.check_file_contents('a', 'something in a\n')
73
73
 
 
74
    def test_fancy_rename_fails_safe(self):
 
75
        """Ensure that unlink failures restore original state"""
 
76
        def raise_path(path):
 
77
            raise Exception("path")
 
78
        self.build_tree(['a', 'b'])
 
79
        self.failUnlessExists('a')
 
80
        self.assertRaises(Exception, osutils.fancy_rename, 'a', 'b',
 
81
            os.rename, unlink_func=raise_path)
 
82
        self.failUnlessExists('a')
 
83
 
74
84
    def test_rename(self):
75
85
        # Rename should be semi-atomic on all platforms
76
86
        open('a', 'wb').write('something in a\n')