/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

MergeĀ fromĀ remote-transport

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
197
197
        self.assertFormatedDelta('1 second in the future', -1)
198
198
        self.assertFormatedDelta('2 seconds in the future', -2)
199
199
 
 
200
    def test_dereference_path(self):
 
201
        if not osutils.has_symlinks():
 
202
            raise TestSkipped('Symlinks are not supported on this platform')
 
203
        cwd = osutils.realpath('.')
 
204
        os.mkdir('bar')
 
205
        bar_path = osutils.pathjoin(cwd, 'bar')
 
206
        # Using './' to avoid bug #1213894 (first path component not
 
207
        # dereferenced) in Python 2.4.1 and earlier
 
208
        self.assertEqual(bar_path, osutils.realpath('./bar'))
 
209
        os.symlink('bar', 'foo')
 
210
        self.assertEqual(bar_path, osutils.realpath('./foo'))
 
211
        
 
212
        # Does not dereference terminal symlinks
 
213
        foo_path = osutils.pathjoin(cwd, 'foo')
 
214
        self.assertEqual(foo_path, osutils.dereference_path('./foo'))
 
215
 
 
216
        # Dereferences parent symlinks
 
217
        os.mkdir('bar/baz')
 
218
        baz_path = osutils.pathjoin(bar_path, 'baz')
 
219
        self.assertEqual(baz_path, osutils.dereference_path('./foo/baz'))
 
220
 
 
221
        # Dereferences parent symlinks that are the first path element
 
222
        self.assertEqual(baz_path, osutils.dereference_path('foo/baz'))
 
223
 
 
224
        # Dereferences parent symlinks in absolute paths
 
225
        foo_baz_path = osutils.pathjoin(foo_path, 'baz')
 
226
        self.assertEqual(baz_path, osutils.dereference_path(foo_baz_path))
 
227
 
200
228
 
201
229
class TestSafeUnicode(TestCase):
202
230