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.
- 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. Does not implement loadPlugins, so it
may only be used with a static list of plugins.
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.
-
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.