/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-07-07 15:22:42 UTC
  • mfrom: (1843 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1846.
  • Revision ID: john@arbash-meinel.com-20060707152242-a7b5e0afd64d9d5a
[merge] bzr.dev 1843

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
        self.assertEqual('path/to/foo', osutils._win32_normpath('path//from/../to/./foo'))
177
177
 
178
178
    def test_getcwd(self):
179
 
        self.assertEqual(os.getcwdu().replace('\\', '/'), osutils._win32_getcwd())
 
179
        cwd = osutils._win32_getcwd()
 
180
        os_cwd = os.getcwdu()
 
181
        self.assertEqual(os_cwd[1:].replace('\\', '/'), cwd[1:])
 
182
        # win32 is inconsistent whether it returns lower or upper case
 
183
        # and even if it was consistent the user might type the other
 
184
        # so we force it to uppercase
 
185
        # running python.exe under cmd.exe return capital C:\\
 
186
        # running win32 python inside a cygwin shell returns lowercase
 
187
        self.assertEqual(os_cwd[0].upper(), cwd[0])
 
188
 
 
189
    def test_fixdrive(self):
 
190
        self.assertEqual('H:/foo', osutils._win32_fixdrive('h:/foo'))
 
191
        self.assertEqual('H:/foo', osutils._win32_fixdrive('H:/foo'))
 
192
        self.assertEqual('C:\\foo', osutils._win32_fixdrive('c:\\foo'))
180
193
 
181
194
 
182
195
class TestWin32FuncsDirs(TestCaseInTempDir):
213
226
        self.failIfExists('b')
214
227
        self.assertFileEqual('baz\n', 'a')
215
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
 
216
259
 
217
260
class TestSplitLines(TestCase):
218
261