ÿØÿàJFIFÿþ ÿÛC       ÿÛC ÿÀÿÄÿÄ"#QrÿÄÿÄ&1!A"2qQaáÿÚ ?Øy,æ/3JæÝ¹È߲؋5êXw²±ÉyˆR”¾I0ó2—PI¾IÌÚiMö¯–þrìN&"KgX:Šíµ•nTJnLK„…@!‰-ý ùúmë;ºgµŒ&ó±hw’¯Õ@”Ü— 9ñ-ë.²1<yà‚¹ïQÐU„ہ?.’¦èûbß±©Ö«Âw*VŒ) `$‰bØÔŸ’ëXÖ-ËTÜíGÚ3ð«g Ÿ§¯—Jx„–’U/ÂÅv_s(Hÿ@TñJÑãõçn­‚!ÈgfbÓc­:él[ðQe 9ÀPLbÃãCµm[5¿ç'ªjglå‡Ûí_§Úõl-;"PkÞÞÁQâ¼_Ñ^¢SŸx?"¸¦ùY騐ÒOÈ q’`~~ÚtËU¹CڒêV  I1Áß_ÿÙ 3Sc@sdZddlZddlZddlZddlZddlmZddlm Z ddl Z ddl m Z ddlmZddlmZyddlZWnddlZnXyddlmZWnddlmZnXd d d d d gZejeZdefdYZdefdYZd efdYZdddYZd efdYZd efdYZ y)ddl!Z!d ee fdYZ"Wn'e#k rd e fdYZ"nXd e"fdYZ$dS(s 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: :class:`PluginManager` This manager doesn't implement loadPlugins, so it can only work with a static list of plugins. :class:`BuiltinPluginManager` This manager loads plugins referenced in ``nose.plugins.builtin``. :class:`EntryPointPluginManager` This manager uses setuptools entrypoints to load plugins. :class:`ExtraPluginsPluginManager` This manager loads extra plugins specified with the keyword `addplugins`. :class:`DefaultPluginMananger` This is the manager class that will be used by default. If setuptools is installed, it is a subclass of :class:`EntryPointPluginManager` and :class:`BuiltinPluginManager`; otherwise, an alias to :class:`BuiltinPluginManager`. :class:`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 :class:`TextTestRunner`. It is a subclass of :class:`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 :class:`nose.config.Config` instance that you pass to :class:`TestProgram` (or :func:`main` or :func:`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``. iN(tchain(twarn(tFailure(tIPluginInterface(t sort_list(tStringIOtDefaultPluginManagert PluginManagertEntryPointPluginManagertBuiltinPluginManagertRestrictedPluginManagert PluginProxycBs_eZdZeZdZdZdZdZdZ dZ dZ d dZ 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. cCsyt|j||_Wn-tk rHtd||jjfnX|j||_g|_x|D]}|j||qkWdS(Ns%s is not a valid %s method( tgetattrt interfacetmethodtAttributeErrort__name__tmakeCalltcalltpluginst addPlugin(tselfRRtp((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt__init__Ws   cOs|j||S(N(R(Rtargtkw((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt__call__bscs~t||d}|dk rz|dkrattj|ddkra|fd}n|jj||fndS(s`Add plugin to my list of plugins to call, if it has the attribute I'm bound to. tloadTestsFromModuleiics |S(N((tmoduletpathtkwargs(t orig_meth(sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pytntN(R tNonetlentinspectt getargspecRtappend(RtpluginRtmeth((RsE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRes  cs_|dkrjSj}t|dtr;fdSt|dtrTjSjSdS(NtloadTestsFromNamest generativecstj||S(N(tlisttgenerate(RR(R(sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR {R!t chainable(t_loadTestsFromNamesRR tFalseRtsimple(RRR(((RsE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRqs   cOsd}gtt|jdg|D]\}}|r%|^q%}x:|jD]/\}}|||}|}|j|qMW|S(sCall 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"tzipR RRR&(RRRtresulttstatictaRR(((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRs(cosx|jD]\}}d}y8|||}|dk rSx|D] }|VqAWnWq ttfk rpq tj}t|Vq q Xq WdS(sFCall all plugins, yielding each item in each non-None result. N(RR"tKeyboardInterruptt SystemExittsystexc_infoR(RRRRR(R3trtexc((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR,s    cOs=x6|jD]+\}}|||}|dk r |Sq WdS(s?Call all plugins, returning the first non-None result. N(RR"(RRRRR(R3((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR0s cCsmg}xZ|jD]O\}}||d|}|dk r|\}}|r_|j|q_qqW||fS(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. RN(RR"textend(RtnamesRtsuiteRR(R3t suite_part((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR.s  N(Rt __module__t__doc__RR RRRRRR,R0R"R.(((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR Ns     t NoPluginscBsneZdZeZdZdZdZdZdZ dZ dZ dZ d Z d ZRS( s(Null Plugin manager that has no plugins.cCsd|_|_dS(N((t_pluginsR(R((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRscCsdS(N(((R((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt__iter__scOsdS(N((Rtargstkwds((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt _doNothingscOsdS(N(((RRERF((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt_emptyIteratorscCs6t|j|}t|dtr+|jS|jSdS(NR*(R R R/RHRG(RRR((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt __getattr__scCs tdS(N(tNotImplementedError(Rtplug((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRscCs tdS(N(RJ(RR((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt addPluginsscCsdS(N((Rtoptionstconfig((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt configurescCsdS(N((R((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyt loadPluginsscCsdS(N((R((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pytsorts(RR@RARR RRDRGRHRIRRLRORPRQ(((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRBs         cBseZdZeZd d dZdZdZdZ dddZ dZ dZ dZ d Zd Zeeed d ZRS(sBase 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. cCsMg|_d|_i|_|r1|j|n|dk rI||_ndS(N((RCt _extrapluginst_proxiesRLR"t proxyClass(RRRT((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRs    cCsIy|j|SWn3tk rD|j||j}||j|Proxy for 0.9 plugins, adapts 0.10 calls to 0.9 standard. cCs ||_dS(N(R'(RR'((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR8scCs|jj||dS(N(R't add_options(Rtparsertenv((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRM;sc Cst|jdsdSddlm}m}|\}}}t||rst|jds`dS|jj|jSt||rt|jdsdS|jj|jS|j }|jj |j||S(NtaddErrori(tSkipTesttDeprecatedTesttaddSkipt addDeprecated( thasattrR'tnose.excRmRnt issubclassRottestRptcapturedOutputRl( RRtterrRmRntectevttbtcapt((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRl>s cCs&t|jdr"|jj|SdS(NtloadTestsFromPath(RqR'R{(Rtfilename((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pytloadTestsFromFilePscCsDt|jdsdS|j}|j}|jj|j|||S(Nt addFailure(RqR'RuttbinfoR~Rt(RRtRvRzR((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR~Ts   cCs9t|jdsdS|j}|jj|j|dS(Nt addSuccess(RqR'RuRRt(RRtRz((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyR\s cCs)t|jdsdS|jj|jS(Nt startTest(RqR'RRt(RRt((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRbscCs)t|jdsdS|jj|jS(NtstopTest(RqR'RRt(RRt((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRgscCst|j|S(N(R R'(Rtval((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRIls(RR@RARtostenvironRMRlR}R~RRRRI(((sE/opt/alt/python27/lib/python2.7/site-packages/nose/plugins/manager.pyRh5s       cBs)eZdZddeffZdZRS(shPlugin manager that loads plugins from the `nose.plugins` and `nose.plugins.0.10` entry points. snose.plugins.0.10s nose.pluginsc Csddlm}i}x|jD]\}}x||D]}|j|krTq9nt||j2sB       m&T;%