/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: Martin Pool
  • Date: 2009-03-10 01:22:57 UTC
  • mfrom: (4099 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4101.
  • Revision ID: mbp@sourcefrog.net-20090310012257-rvtds5ic7ard4iza
merge news

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        canonical_relpath,
41
41
        )
42
42
from bzrlib.tests import (
43
 
        adapt_tests,
44
43
        Feature,
45
44
        probe_unicode_in_user_encoding,
46
 
        split_suite_by_re,
47
45
        StringIOWrapper,
48
46
        SymlinkFeature,
49
47
        CaseInsCasePresFilenameFeature,
50
48
        TestCase,
51
49
        TestCaseInTempDir,
52
 
        TestScenarioApplier,
53
50
        TestSkipped,
54
51
        )
55
52
from bzrlib.tests.file_utils import (
882
879
        self.assertEqual(expected_dirblocks[1:],
883
880
            [(dirinfo, [line[0:3] for line in block]) for dirinfo, block in result])
884
881
 
 
882
    def test_walkdirs_os_error(self):
 
883
        # <https://bugs.edge.launchpad.net/bzr/+bug/338653>
 
884
        # Pyrex readdir didn't raise useful messages if it had an error
 
885
        # reading the directory
 
886
        if sys.platform == 'win32':
 
887
            raise tests.TestNotApplicable(
 
888
                "readdir IOError not tested on win32")
 
889
        os.mkdir("test-unreadable")
 
890
        os.chmod("test-unreadable", 0000)
 
891
        # must chmod it back so that it can be removed
 
892
        self.addCleanup(lambda: os.chmod("test-unreadable", 0700))
 
893
        # The error is not raised until the generator is actually evaluated.
 
894
        # (It would be ok if it happened earlier but at the moment it
 
895
        # doesn't.)
 
896
        e = self.assertRaises(OSError, list,
 
897
            osutils._walkdirs_utf8("."))
 
898
        self.assertEquals(e.filename, './test-unreadable')
 
899
        self.assertEquals(str(e),
 
900
            "[Errno 13] chdir: Permission denied: './test-unreadable'")
 
901
 
885
902
    def test__walkdirs_utf8(self):
886
903
        tree = [
887
904
            '.bzr',