~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-17 20:11:30 UTC
  • mto: This revision was merged to the branch mainline in revision 3532.
  • Revision ID: john@arbash-meinel.com-20080317201130-254scn9jqanfvc92
Raise a clear error about the offending filename when there is a filename with bad characters.
Related to bug #77657

Show diffs side-by-side

added added

removed removed

Lines of Context:
3074
3074
FTPServerFeature = _FTPServerFeature()
3075
3075
 
3076
3076
 
 
3077
class _UnicodeFilename(Feature):
 
3078
    """Does the filesystem support Unicode filenames?"""
 
3079
 
 
3080
    def _probe(self):
 
3081
        try:
 
3082
            os.stat(u'\u03b1')
 
3083
        except UnicodeEncodeError:
 
3084
            return False
 
3085
        except (IOError, OSError):
 
3086
            # The filesystem allows the Unicode filename but the file doesn't
 
3087
            # exist.
 
3088
            return True
 
3089
        else:
 
3090
            # The filesystem allows the Unicode filename and the file exists,
 
3091
            # for some reason.
 
3092
            return True
 
3093
 
 
3094
UnicodeFilename = _UnicodeFilename()
 
3095
 
 
3096
 
 
3097
class _UTF8Filesystem(Feature):
 
3098
    """Is the filesystem UTF-8?"""
 
3099
 
 
3100
    def _probe(self):
 
3101
        if osutils._fs_enc.upper() in ('UTF-8', 'UTF8'):
 
3102
            return True
 
3103
        return False
 
3104
 
 
3105
UTF8Filesystem = _UTF8Filesystem()
 
3106
 
 
3107
 
3077
3108
class _CaseInsensitiveFilesystemFeature(Feature):
3078
3109
    """Check if underlined filesystem is case-insensitive
3079
3110
    (e.g. on Windows, Cygwin, MacOS)