/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: Canonical.com Patch Queue Manager
  • Date: 2008-07-08 17:09:38 UTC
  • mfrom: (3287.20.5 non_utf8_77657)
  • Revision ID: pqm@pqm.ubuntu.com-20080708170938-gt3lvh2xejc4w8vf
(jam) Give a better error when encountering a bad filename (bug
        #77657)

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__
3174
3174
FTPServerFeature = _FTPServerFeature()
3175
3175
 
3176
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
 
3177
3208
class _CaseInsensitiveFilesystemFeature(Feature):
3178
3209
    """Check if underlined filesystem is case-insensitive
3179
3210
    (e.g. on Windows, Cygwin, MacOS)