/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/__init__.py

  • Committer: Martin Pool
  • Date: 2008-07-14 07:47:45 UTC
  • mfrom: (3536 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3537.
  • Revision ID: mbp@sourcefrog.net-20080714074745-ow7wqktgjbn6xb6q
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
923
923
        """
924
924
        try:
925
925
            list(func(*args, **kwargs))
926
 
        except excClass:
927
 
            return
 
926
        except excClass, e:
 
927
            return e
928
928
        else:
929
929
            if getattr(excClass,'__name__', None) is not None:
930
930
                excName = excClass.__name__
3073
3073
 
3074
3074
    def _probe(self):
3075
3075
        try:
3076
 
            os.stat(u'\u03b1')
 
3076
            # Check for character combinations unlikely to be covered by any
 
3077
            # single non-unicode encoding. We use the characters
 
3078
            # - greek small letter alpha (U+03B1) and
 
3079
            # - braille pattern dots-123456 (U+283F).
 
3080
            os.stat(u'\u03b1\u283f')
3077
3081
        except UnicodeEncodeError:
3078
3082
            return False
3079
3083
        except (IOError, OSError):
3170
3174
FTPServerFeature = _FTPServerFeature()
3171
3175
 
3172
3176
 
 
3177
class _UnicodeFilename(Feature):
 
3178
    """Does the filesystem support Unicode filenames?"""
 
3179
 
 
3180
    def _probe(self):
 
3181
        try:
 
3182
            os.stat(u'\u03b1')
 
3183
        except UnicodeEncodeError:
 
3184
            return False
 
3185
        except (IOError, OSError):
 
3186
            # The filesystem allows the Unicode filename but the file doesn't
 
3187
            # exist.
 
3188
            return True
 
3189
        else:
 
3190
            # The filesystem allows the Unicode filename and the file exists,
 
3191
            # for some reason.
 
3192
            return True
 
3193
 
 
3194
UnicodeFilename = _UnicodeFilename()
 
3195
 
 
3196
 
 
3197
class _UTF8Filesystem(Feature):
 
3198
    """Is the filesystem UTF-8?"""
 
3199
 
 
3200
    def _probe(self):
 
3201
        if osutils._fs_enc.upper() in ('UTF-8', 'UTF8'):
 
3202
            return True
 
3203
        return False
 
3204
 
 
3205
UTF8Filesystem = _UTF8Filesystem()
 
3206
 
 
3207
 
3173
3208
class _CaseInsensitiveFilesystemFeature(Feature):
3174
3209
    """Check if underlined filesystem is case-insensitive
3175
3210
    (e.g. on Windows, Cygwin, MacOS)