~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-07-03 13:56:48 UTC
  • mfrom: (1711.4.41 win32-accepted)
  • Revision ID: pqm@pqm.ubuntu.com-20060703135648-b927e5efb9f5b907
(jam) cleanup for win32, close open file handles, tests pass

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