/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: 2009-12-09 02:53:42 UTC
  • mfrom: (4873.2.3 2.1.0b4-win32-test-imports)
  • Revision ID: pqm@pqm.ubuntu.com-20091209025342-sidvxfcqdgxmuz59
(jam) Get the test suite running again on Windows, (bug #492561)

Show diffs side-by-side

added added

removed removed

Lines of Context:
4247
4247
UnicodeFilenameFeature = _UnicodeFilenameFeature()
4248
4248
 
4249
4249
 
 
4250
class ModuleAvailableFeature(Feature):
 
4251
    """This is a feature than describes a module we want to be available.
 
4252
 
 
4253
    Declare the name of the module in __init__(), and then after probing, the
 
4254
    module will be available as 'self.module'.
 
4255
 
 
4256
    :ivar module: The module if it is available, else None.
 
4257
    """
 
4258
 
 
4259
    def __init__(self, module_name):
 
4260
        super(ModuleAvailableFeature, self).__init__()
 
4261
        self.module_name = module_name
 
4262
 
 
4263
    def _probe(self):
 
4264
        try:
 
4265
            self._module = __import__(self.module_name, {}, {}, [''])
 
4266
            return True
 
4267
        except ImportError:
 
4268
            return False
 
4269
 
 
4270
    @property
 
4271
    def module(self):
 
4272
        if self.available(): # Make sure the probe has been done
 
4273
            return self._module
 
4274
        return None
 
4275
    
 
4276
    def feature_name(self):
 
4277
        return self.module_name
 
4278
 
 
4279
 
 
4280
 
4250
4281
def probe_unicode_in_user_encoding():
4251
4282
    """Try to encode several unicode strings to use in unicode-aware tests.
4252
4283
    Return first successfull match.