/usr/lib/python2.6/site-packages/nose/plugins
Edit: /usr/lib/python2.6/site-packages/nose/plugins/manager.pyo (18370B)
Ñò
ý÷ò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
e s t chainable( t _loadTestsFromNamesR R t Falset chaint simple( R R R ( ( R s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR [ s
c O s‘ d } g } t t | i d g ƒ | ƒ D] \ } } | o | | q) q) ~ } x: | i D]/ \ } } | | | Ž } | } | i | ƒ qZ W| S( s˜ Call plugins in a chain, where the result of each plugin call is
sent to the next plugin as input. The final output result is returned.
t static_argsN( R t zipR R R R ( R R R t resultt _[1]t statict aR R ( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR$ l s (
c o s x– | i D]‹ \ } } d } y: | | | Ž } | d j o x | D] } | VqB Wn Wq
t t f j
o
‚ q
t i ƒ } t | Œ Vq
q
Xq
Wd S( sF Call all plugins, yielding each item in each non-None result.
N( R R t KeyboardInterruptt
SystemExitt syst exc_infoR ( R R R R R R( t rt exc( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR | s
c O s? x8 | i D]- \ } } | | | Ž } | d j o | Sq
Wd S( s? Call all plugins, returning the first non-None result.
N( R R ( R R R R R R( ( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR% s
c C sq g } x^ | i D]S \ } } | | d | ƒ} | d j o( | \ } } | o | i | ƒ qc q q W| | f S( s
Chainable but not quite normal. Plugins return a tuple of
(tests, names) after processing the names. The tests are added
to a suite that is accumulated throughout the full call, while
names are input for the next plugin in the chain.
t moduleN( R R t extend( R t namesR2 t suiteR R R( t
suite_part( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR" • s
N( R
t
__module__t __doc__R R
R R R R R$ R R% R R" ( ( ( s8 /usr/lib/python2.6/site-packages/nose/plugins/manager.pyR <