~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: 2009-07-23 17:00:27 UTC
  • mfrom: (4555.2.3 1.18-relpath-394227)
  • Revision ID: pqm@pqm.ubuntu.com-20090723170027-0tfrsqpe3tiqnpcb
(jam) Fix bug #394227,
        prevent osutils.relpath() from going into an infinite loop.

Show diffs side-by-side

added added

removed removed

Lines of Context:
625
625
        self.assertEqual("1234", output.getvalue())
626
626
 
627
627
 
 
628
class TestRelpath(tests.TestCase):
 
629
 
 
630
    def test_simple_relpath(self):
 
631
        cwd = osutils.getcwd()
 
632
        subdir = cwd + '/subdir'
 
633
        self.assertEqual('subdir', osutils.relpath(cwd, subdir))
 
634
 
 
635
    def test_deep_relpath(self):
 
636
        cwd = osutils.getcwd()
 
637
        subdir = cwd + '/sub/subsubdir'
 
638
        self.assertEqual('sub/subsubdir', osutils.relpath(cwd, subdir))
 
639
 
 
640
    def test_not_relative(self):
 
641
        self.assertRaises(errors.PathNotChild,
 
642
                          osutils.relpath, 'C:/path', 'H:/path')
 
643
        self.assertRaises(errors.PathNotChild,
 
644
                          osutils.relpath, 'C:/', 'H:/path')
 
645
 
 
646
 
628
647
class TestSafeUnicode(tests.TestCase):
629
648
 
630
649
    def test_from_ascii_string(self):