Plugin Manager — nose 1.3.7 documentation

# Plugin Manager

A plugin manager class is used to load plugins, manage the list of loaded plugins, and proxy calls to those plugins.

The plugin managers provided with nose are:

`PluginManager`
  This manager doesn’t implement loadPlugins, so it can only work with a static list of plugins.
`BuiltinPluginManager`
  This manager loads plugins referenced in `nose.plugins.builtin`.
`EntryPointPluginManager`
  This manager uses setuptools entrypoints to load plugins.
`ExtraPluginsPluginManager`
  This manager loads extra plugins specified with the keyword addplugins.
`DefaultPluginMananger`
  This is the manager class that will be used by default. If setuptools is installed, it is a subclass of `EntryPointPluginManager` and `BuiltinPluginManager`; otherwise, an alias to `BuiltinPluginManager`.
`RestrictedPluginManager`
  This manager is for use in test runs where some plugin calls are not available, such as runs started with `python setup.py test`, where the test runner is the default unittest `TextTestRunner`. It is a subclass of `DefaultPluginManager`.

## Writing a plugin manager

If you want to load plugins via some other means, you can write a plugin manager and pass an instance of your plugin manager class when instantiating the `nose.config.Config` instance that you pass to `TestProgram` (or `main()` or `run()`).

To implement your plugin loading scheme, implement `loadPlugins()`, and in that method, call `addPlugin()` with an instance of each plugin you wish to make available. Make sure to call `super(self).loadPlugins()` as well if have subclassed a manager other than `PluginManager`.

class `nose.plugins.manager.` `PluginManager`(plugins=(), proxyClass=None)

  Base class for plugin managers. PluginManager is intended to be used only with a static list of plugins. The loadPlugins() implementation only reloads plugins from _extraplugins to prevent those from being overridden by a subclass.

  The basic functionality of a plugin manager is to proxy all unknown attributes through a `PluginProxy` to a list of plugins.

  Note that the list of plugins may not be changed after the first plugin call.

  `addPlugins`(plugins=(), extraplugins=())

    extraplugins are maintained in a separate list and re-added by loadPlugins() to prevent their being overwritten by plugins added by a subclass of PluginManager

  `configure`(options, config)

    Configure the set of plugins with the given options and config instance. After configuration, disabled plugins are removed from the plugins list.

  `plugins`

    Access the list of plugins managed by this plugin manager

  `proxyClass`

    alias of `PluginProxy`

class `nose.plugins.manager.` `EntryPointPluginManager`(plugins=(), proxyClass=None)

  Plugin manager that loads plugins from the nose.plugins and nose.plugins.0.10 entry points.

  `loadPlugins`()

    Load plugins by iterating the nose.plugins entry point.

class `nose.plugins.manager.` `BuiltinPluginManager`(plugins=(), proxyClass=None)

  Plugin manager that loads plugins from the list in nose.plugins.builtin.

  `loadPlugins`()

    Load plugins in nose.plugins.builtin

class `nose.plugins.manager.` `RestrictedPluginManager`(plugins=(), exclude=(), load=True)

  Plugin manager that restricts the plugin list to those not excluded by a list of exclude methods. Any plugin that implements an excluded method will be removed from the manager’s plugin list after plugins are loaded.