/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-29 20:26:43 UTC
  • mto: (1711.4.39 win32-accepted)
  • mto: This revision was merged to the branch mainline in revision 1836.
  • Revision ID: john@arbash-meinel.com-20060629202643-db14152615498634
Change _win32_rename() so that it raises ENOENT *before* it tries any renaming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
226
226
        self.failIfExists('b')
227
227
        self.assertFileEqual('baz\n', 'a')
228
228
 
 
229
    def test_rename_missing_file(self):
 
230
        a = open('a', 'wb')
 
231
        a.write('foo\n')
 
232
        a.close()
 
233
 
 
234
        try:
 
235
            osutils._win32_rename('b', 'a')
 
236
        except (IOError, OSError), e:
 
237
            self.assertEqual(errno.ENOENT, e.errno)
 
238
        self.assertFileEqual('foo\n', 'a')
 
239
 
 
240
    def test_rename_missing_dir(self):
 
241
        os.mkdir('a')
 
242
        try:
 
243
            osutils._win32_rename('b', 'a')
 
244
        except (IOError, OSError), e:
 
245
            self.assertEqual(errno.ENOENT, e.errno)
 
246
 
 
247
    def test_rename_current_dir(self):
 
248
        os.mkdir('a')
 
249
        os.chdir('a')
 
250
        # You can't rename the working directory
 
251
        # doing rename non-existant . usually
 
252
        # just raises ENOENT, since non-existant
 
253
        # doesn't exist.
 
254
        try:
 
255
            osutils._win32_rename('b', '.')
 
256
        except (IOError, OSError), e:
 
257
            self.assertEqual(errno.ENOENT, e.errno)
 
258
 
229
259
 
230
260
class TestSplitLines(TestCase):
231
261