Ñò
ý÷òGc
@ s^ d Z d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l Z d d d d d
g Z
e i e ƒ Z
d e f d „ ƒ YZ d
e f d „ ƒ YZ d e f d „ ƒ YZ d d d „ ƒ YZ d e f d „ ƒ YZ d e f d „ ƒ YZ y) d d k Z d e e f d „ ƒ YZ Wn e j
o
e Z n Xd
e f d „ ƒ YZ d S( sZ
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 each plugin
you wish to make available. Make sure to call
``super(self).loadPlugins()`` as well if have subclassed a manager
other than ``PluginManager``.
iÿÿÿÿN( t warn( t Failure( t IPluginInterfacet DefaultPluginManagert
PluginManagert EntryPointPluginManagert BuiltinPluginManagert RestrictedPluginManagert PluginProxyc B s_ e Z d Z e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z
d „ Z d d „ Z
RS(
s# Proxy for plugin calls. Essentially a closure bound to the
given call and plugin list.
The plugin proxy also must be bound to a particular plugin
interface specification, so that it knows what calls are available
and any special handling that is required for each call.
c C s‹ y t | i | ƒ | _ Wn/ t j
o# t d | | i i f ƒ ‚ n X| i | ƒ | _ g | _ x | D] } | i | | ƒ qm Wd S( Ns %s is not a valid %s method( t getattrt interfacet methodt AttributeErrort __name__t makeCallt callt pluginst addPlugin( t selfR R t p( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyt __init__E s c O s | i | | Ž S( N( R ( R t argt kw( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyt __call__P s c C s= t | | d ƒ } | d j o | i i | | f ƒ n d S( s` Add plugin to my list of plugins to call, if it has the attribute
I'm bound to.
N( R t NoneR t append( R t pluginR t meth( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR S s
c se | d j o ˆ i Sˆ i } t | d t ƒ o ‡ f d † St | d t ƒ o ˆ i Sˆ i Sd S( Nt loadTestsFromNamest
generativec s t ˆ i | | Ž ƒ S( ( t listt generate( R R ( R ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyt