~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-29 21:35:05 UTC
  • mfrom: (4576 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4577.
  • Revision ID: john@arbash-meinel.com-20090729213505-tkqsvy1zfpocu75w
Merge bzr.dev 4576 in prep for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
240
240
        self.failIfExists('dir')
241
241
 
242
242
 
 
243
class TestDeleteAny(tests.TestCaseInTempDir):
 
244
 
 
245
    def test_delete_any_readonly(self):
 
246
        # from <https://bugs.launchpad.net/bzr/+bug/218206>
 
247
        self.build_tree(['d/', 'f'])
 
248
        osutils.make_readonly('d')
 
249
        osutils.make_readonly('f')
 
250
 
 
251
        osutils.delete_any('f')
 
252
        osutils.delete_any('d')
 
253
 
 
254
 
243
255
class TestKind(tests.TestCaseInTempDir):
244
256
 
245
257
    def test_file_kind(self):
613
625
        self.assertEqual("1234", output.getvalue())
614
626
 
615
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
 
616
647
class TestSafeUnicode(tests.TestCase):
617
648
 
618
649
    def test_from_ascii_string(self):