/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/features.py

Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""A collection of commonly used 'Features' to optionally run tests.
18
18
"""
19
19
 
 
20
from __future__ import absolute_import
 
21
 
20
22
import os
21
23
import subprocess
22
24
import stat
188
190
        return self.module_name
189
191
 
190
192
 
 
193
class PluginLoadedFeature(Feature):
 
194
    """Check whether a plugin with specific name is loaded.
 
195
 
 
196
    This is different from ModuleAvailableFeature, because
 
197
    plugins can be available but explicitly disabled
 
198
    (e.g. through BRZ_DISABLE_PLUGINS=blah).
 
199
 
 
200
    :ivar plugin_name: The name of the plugin
 
201
    """
 
202
 
 
203
    def __init__(self, plugin_name):
 
204
        super(PluginLoadedFeature, self).__init__()
 
205
        self.plugin_name = plugin_name
 
206
 
 
207
    def _probe(self):
 
208
        import breezy
 
209
        return self.plugin_name in breezy.global_state.plugins
 
210
 
 
211
    @property
 
212
    def plugin(self):
 
213
        import breezy
 
214
        return breezy.global_state.plugins.get(self.plugin_name)
 
215
 
 
216
    def feature_name(self):
 
217
        return '%s plugin' % self.plugin_name
 
218
 
 
219
 
191
220
class _HTTPSServerFeature(Feature):
192
221
    """Some tests want an https Server, check if one is available.
193
222
 
346
375
not_running_as_root = _NotRunningAsRoot()
347
376
 
348
377
apport = ModuleAvailableFeature('apport')
349
 
gpgme = ModuleAvailableFeature('gpgme')
 
378
gpg = ModuleAvailableFeature('gpg')
350
379
lzma = ModuleAvailableFeature('lzma')
351
380
meliae = ModuleAvailableFeature('meliae.scanner')
352
381
paramiko = ModuleAvailableFeature('paramiko')