Ejemplo n.º 1
0
    def setUp(self):
        buildbot.plugins.db._DB = buildbot.plugins.db._PluginDB()

        with mock.patch("buildbot.plugins.db.iter_entry_points", provide_worker_fake_entries):
            self.worker_ns = db.get_plugins("worker")
            self.buildslave_ns = db.get_plugins("buildslave")
            self.util_ns = db.get_plugins("util")
Ejemplo n.º 2
0
    def setUp(self):
        buildbot.plugins.db._DB = buildbot.plugins.db._PluginDB()

        with mock.patch('buildbot.plugins.db.iter_entry_points',
                        provide_worker_fake_entries):
            self.worker_ns = db.get_plugins('worker')
            self.buildslave_ns = db.get_plugins('buildslave')
            self.util_ns = db.get_plugins('util')
Ejemplo n.º 3
0
    def test_check_group_registration(self):
        with mock.patch.object(buildbot.plugins.db, '_DB', db._PluginDB()):
            # The groups will be prepended with namespace, so info() will
            # return a dictionary with right keys, but no data
            groups = set(_FAKE_ENTRIES.keys())
            for group in groups:
                db.get_plugins(group)

            registered = set(db.info().keys())
            self.assertEqual(registered, groups)
            self.assertEqual(registered, set(db.namespaces()))
Ejemplo n.º 4
0
    def test_missing_plugin(self):
        plugins = db.get_plugins('interface', interface=ITestInterface)

        with self.assertRaises(AttributeError):
            getattr(plugins, 'bad')
        with self.assertRaises(PluginDBError):
            plugins.get('bad')
        with self.assertRaises(PluginDBError):
            plugins.get('good.extra')
Ejemplo n.º 5
0
    def __init__(self):
        service.AsyncMultiService.__init__(self)

        self.port = None
        self.port_service = None
        self.site = None

        # load the apps early, in case something goes wrong in Python land
        self.apps = get_plugins('www', None, load_now=True)
Ejemplo n.º 6
0
def addRepository(name, config):
    vcs_type = config['vcs_type']
    plugins = get_plugins("travis", IVCSManager, load_now=False)
    if vcs_type in plugins.names:
        plugin = plugins.get(vcs_type)
        r = repository_db[name] = plugin(**config)
        return r

    raise KeyError("No VCS manager for %s, got %s" %
                   (vcs_type, plugins.info_all()))
Ejemplo n.º 7
0
    def __init__(self, master):
        service.AsyncMultiService.__init__(self)
        self.setName('www')
        self.master = master

        self.port = None
        self.port_service = None
        self.site = None

        # load the apps early, in case something goes wrong in Python land
        self.apps = get_plugins('www', None, load_now=True)

        if 'base' not in self.apps:
            raise RuntimeError("could not find buildbot-www; is it installed?")
Ejemplo n.º 8
0
    def __init__(self, dialects=None, master=None):
        """
        The keys of 'dialects' select a modules to load under
        master/buildbot/www/hooks/
        The value is passed to the module's getChanges function, providing
        configuration options to the dialect.
        """
        super().__init__(master)

        if dialects is None:
            dialects = {}
        self.dialects = dialects
        self._dialect_handlers = {}
        self.request_dialect = None
        self._plugins = get_plugins("webhooks")
Ejemplo n.º 9
0
    def test_interface_provided_simple(self):
        # Basic check before the actual test
        self.assertTrue(ITestInterface.implementedBy(ClassWithInterface))

        plugins = db.get_plugins('interface', interface=ITestInterface)

        self.assertTrue('good' in plugins.names)

        result_get = plugins.get('good')
        result_getattr = plugins.good
        self.assertFalse(result_get is None)
        self.assertTrue(result_get is result_getattr)

        # Make sure we actually got our class
        greeter = result_get('yes')
        self.assertEqual('yes', greeter.hello())
        self.assertEqual('no', greeter.hello('no'))
Ejemplo n.º 10
0
    def test_interface_provided_deep(self):
        # Basic check before the actual test
        self.assertTrue(ITestInterface.implementedBy(ClassWithInterface))

        plugins = db.get_plugins("interface", interface=ITestInterface)

        self.assertTrue("deep.path" in plugins.names)

        self.assertTrue("deep.path" in plugins)
        self.assertFalse("even.deeper.path" in plugins)

        result_get = plugins.get("deep.path")
        result_getattr = plugins.deep.path
        self.assertFalse(result_get is None)
        self.assertTrue(result_get is result_getattr)

        # Make sure we actually got our class
        greeter = result_get("yes")
        self.assertEqual("yes", greeter.hello())
        self.assertEqual("no", greeter.hello("no"))
Ejemplo n.º 11
0
 def test_failure_on_unknown_plugin_info(self):
     plugins = db.get_plugins("interface")
     self.assertRaises(PluginDBError, plugins.info, "bad")
Ejemplo n.º 12
0
 def test_failure_on_unknown_plugin_info(self):
     plugins = db.get_plugins('interface')
     with self.assertRaises(PluginDBError):
         plugins.info('bad')
Ejemplo n.º 13
0
 def test_get_info_on_a_known_plugin(self):
     plugins = db.get_plugins("interface")
     self.assertEqual(("non-existant", "irrelevant"), plugins.info("good"))
Ejemplo n.º 14
0
 def test_no_interface_provided_deps_failed(self):
     plugins = db.get_plugins('no_interface_failed', check_extras=True)
     self.assertRaises(PluginDBError, plugins.get, 'good')
Ejemplo n.º 15
0
 def test_failure_on_unknown_plugin_get(self):
     plugins = db.get_plugins('interface')
     self.assertRaises(PluginDBError, plugins.get, 'bad')
Ejemplo n.º 16
0
 def test_no_interface_provided(self):
     plugins = db.get_plugins('no_interface')
     self.assertFalse(plugins.get('good') is None)
Ejemplo n.º 17
0
 def test_required_interface_not_provided(self):
     plugins = db.get_plugins('no_interface_again',
                              interface=ITestInterface)
     self.assertTrue(plugins._interface is ITestInterface)
     self.assertRaises(PluginDBError, plugins.get, 'good')
Ejemplo n.º 18
0
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.interfaces import IWorker
from buildbot.plugins.db import get_plugins

__all__ = [
    "changes",
    "schedulers",
    "steps",
    "util",
    "reporters",
    "statistics",
    "worker",
    "buildslave",  # deprecated, use 'worker' instead.
]


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildslave'
changes = get_plugins("changes", IChangeSource)
schedulers = get_plugins("schedulers", IScheduler)
steps = get_plugins("steps", IBuildStep)
util = get_plugins("util", None)
reporters = get_plugins("reporters", None)

# For plugins that are not updated to the new worker names, plus fallback of
# current Buildbot plugins for old configuration files.
buildslave = get_plugins("buildslave", IWorker)
# Worker entry point for new/updated plugins.
worker = get_plugins("worker", IWorker)
Ejemplo n.º 19
0
 def test_required_interface_not_provided(self):
     plugins = db.get_plugins('no_interface_again',
                              interface=ITestInterface)
     self.assertTrue(plugins._interface is ITestInterface)
     with self.assertRaises(PluginDBError):
         plugins.get('good')
Ejemplo n.º 20
0
def getSupportedVCSTypes():
    plugins = get_plugins("travis", IVCSManager, load_now=False)
    return {vcs_type: plugins.get(vcs_type).description
            for vcs_type in plugins.names}
Ejemplo n.º 21
0
 def test_interface_provided_deps_failed(self):
     plugins = db.get_plugins('interface_failed', interface=ITestInterface,
                              check_extras=True)
     with self.assertRaises(PluginDBError):
         plugins.get('good')
Ejemplo n.º 22
0
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

"""
Buildbot plugin infrastructure
"""

from buildbot import statistics
from buildbot.interfaces import IBuildWorker
from buildbot.interfaces import IBuildStep
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.plugins.db import get_plugins


__all__ = ['changes', 'schedulers', 'buildworker', 'steps', 'util', 'reporters', 'statistics']


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildworker'
changes = get_plugins('changes', IChangeSource)
schedulers = get_plugins('schedulers', IScheduler)
buildworker = get_plugins('buildworker', IBuildWorker)
steps = get_plugins('steps', IBuildStep)
util = get_plugins('util', None)
reporters = get_plugins('reporters', None)
Ejemplo n.º 23
0
from buildbot import statistics
from buildbot.interfaces import IBuildStep
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.interfaces import IWorker
from buildbot.plugins.db import get_plugins

__all__ = [
    'changes', 'schedulers', 'steps', 'util', 'reporters', 'statistics',
    'worker', 'secrets', 'webhooks',
    'buildslave',  # deprecated, use 'worker' instead.
]


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildslave'
changes = get_plugins('changes', IChangeSource)
schedulers = get_plugins('schedulers', IScheduler)
steps = get_plugins('steps', IBuildStep)
util = get_plugins('util', None)
reporters = get_plugins('reporters', None)
secrets = get_plugins('secrets', None)
webhooks = get_plugins('webhooks', None)

# For plugins that are not updated to the new worker names, plus fallback of
# current Buildbot plugins for old configuration files.
buildslave = get_plugins('buildslave', IWorker)
# Worker entry point for new/updated plugins.
worker = get_plugins('worker', IWorker)
Ejemplo n.º 24
0
def getSupportedVCSTypes():
    plugins = get_plugins("travis", IVCSManager, load_now=False)
    return {
        vcs_type: plugins.get(vcs_type).description
        for vcs_type in plugins.names
    }
Ejemplo n.º 25
0
 def test_no_interface_provided_deps_failed(self):
     plugins = db.get_plugins('no_interface_failed', check_extras=True)
     with self.assertRaises(PluginDBError):
         plugins.get('good')
Ejemplo n.º 26
0
 def test_failure_on_dups(self):
     with self.assertRaises(PluginDBError):
         db.get_plugins('duplicates', load_now=True)
Ejemplo n.º 27
0
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

"""
Buildbot plugin infrastructure
"""

from buildbot.interfaces import IBuildSlave
from buildbot.interfaces import IBuildStep
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.interfaces import IStatusReceiver
from buildbot.plugins.db import get_plugins


__all__ = ['changes', 'schedulers', 'buildslave', 'steps', 'status', 'util']


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildslave'
changes = get_plugins('changes', IChangeSource)
schedulers = get_plugins('schedulers', IScheduler)
buildslave = get_plugins('buildslave', IBuildSlave)
steps = get_plugins('steps', IBuildStep)
status = get_plugins('status', IStatusReceiver)
util = get_plugins('util', None)
reporters = get_plugins('reporters', None)
Ejemplo n.º 28
0
    def test_missing_plugin(self):
        plugins = db.get_plugins("interface", interface=ITestInterface)

        self.assertRaises(AttributeError, getattr, plugins, "bad")
        self.assertRaises(PluginDBError, plugins.get, "bad")
        self.assertRaises(PluginDBError, plugins.get, "good.extra")
Ejemplo n.º 29
0
 def test_get_info_on_a_known_plugin(self):
     plugins = db.get_plugins('interface')
     self.assertEqual(('non-existent', 'irrelevant'), plugins.info('good'))
Ejemplo n.º 30
0
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Copyright Buildbot Team Members

"""
Buildbot plugin infrastructure
"""

from buildbot.plugins.db import get_plugins
from buildbot.interfaces import IBuildSlave
from buildbot.interfaces import IBuildStep
from buildbot.interfaces import IChangeSource
from buildbot.interfaces import IScheduler
from buildbot.interfaces import IStatusReceiver


__all__ = ['changes', 'schedulers', 'buildslave', 'steps', 'status', 'util']


# Names here match the names of the corresponding Buildbot module, hence
# 'changes', 'schedulers', but 'buildslave'
changes = get_plugins('change_source', IChangeSource)
schedulers = get_plugins('scheduler', IScheduler)
buildslave = get_plugins('build_slave', IBuildSlave)
steps = get_plugins('step', IBuildStep)
status = get_plugins('status', IStatusReceiver)
util = get_plugins('util', None)
Ejemplo n.º 31
0
 def test_no_interface_provided(self):
     plugins = db.get_plugins('no_interface')
     self.assertFalse(plugins.get('good') is None)
Ejemplo n.º 32
0
 def test_interface_provided_deps_failed(self):
     plugins = db.get_plugins("interface_failed", interface=ITestInterface, check_extras=True)
     self.assertRaises(PluginDBError, plugins.get, "good")
Ejemplo n.º 33
0
 def test_get_info_on_a_known_plugin(self):
     plugins = db.get_plugins('interface')
     self.assertEqual(('non-existant', 'irrelevant'), plugins.info('good'))
Ejemplo n.º 34
0
 def test_no_interface_provided(self):
     plugins = db.get_plugins("no_interface")
     self.assertFalse(plugins.get("good") is None)
Ejemplo n.º 35
0
 def test_failure_on_unknown_plugin_get(self):
     plugins = db.get_plugins('interface')
     with self.assertRaises(PluginDBError):
         plugins.get('bad')
Ejemplo n.º 36
0
 def test_failure_on_dups(self):
     with self.assertRaises(PluginDBError):
         db.get_plugins('duplicates', load_now=True)