ó K9•Qc@sjdZddlZddlmZejeƒZd„Zdefd„ƒYZ defd„ƒYZ dS( s— Result Proxy ------------ The result proxy wraps the result instance given to each test. It performs two functions: enabling extended error/failure reporting and calling plugins. As each result event is fired, plugins are called with the same event; however, plugins are called with the nose.case.Test instance that wraps the actual test. So when a test fails and calls result.addFailure(self, err), the result proxy calls addFailure(self.test, err) for each plugin. This allows plugins to have a single stable interface for all test types, and also to manipulate the test object itself by setting the `test` attribute of the nose.case.Test that they receive. iÿÿÿÿN(tConfigcsI‡‡fd†}‡‡fd†}‡‡fd†}t||||ƒS(snCreate a property that proxies attribute ``proxied_attr`` through the local attribute ``local_attr``. cstt|ˆƒˆƒS(N(tgetattr(tself(t local_attrt proxied_attr(s./sys/lib/python2.7/site-packages/nose/proxy.pytfgetscstt|ˆƒˆ|ƒdS(N(tsetattrR(Rtvalue(RR(s./sys/lib/python2.7/site-packages/nose/proxy.pytfsetscstt|ˆƒˆƒdS(N(tdelattrR(R(RR(s./sys/lib/python2.7/site-packages/nose/proxy.pytfdel!s(tproperty(RRtdocRRR ((RRs./sys/lib/python2.7/site-packages/nose/proxy.pytproxied_attributestResultProxyFactorycBs#eZdZdd„Zd„ZRS(srFactory for result proxies. Generates a ResultProxy bound to each test and the result passed to the test. cCs7|dkrtƒ}n||_t|_d|_dS(N(tNoneRtconfigtFalset_ResultProxyFactory__preparedt_ResultProxyFactory__result(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyt__init__*s     cCsw|jsFt|_|jjj|ƒ}|dk rF||_}qFn|jdk ra|j}nt||d|jƒS(sReturn a ResultProxy for the current test. On first call, plugins are given a chance to replace the result used for the remaining tests. If a plugin returns a value from prepareTestResult, that object will be used as the result for all tests. RN(RtTrueRtpluginstprepareTestResultRRt ResultProxy(Rtresultttestt plug_result((s./sys/lib/python2.7/site-packages/nose/proxy.pyt__call__1s    N(t__name__t __module__t__doc__RRR(((s./sys/lib/python2.7/site-packages/nose/proxy.pyR&s RcBsÎeZdZdd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „ZedddƒZedddƒZedddƒZedddƒZRS(sgProxy to TestResults (or other results handler). One ResultProxy is created for each nose.case.Test. The result proxy calls plugins with the nose.case.Test instance (instead of the wrapped test case) as each result call is made. Finally, the real result method is called, also with the nose.case.Test instance as the test parameter. cCsC|dkrtƒ}n||_|j|_||_||_dS(N(RRRRRR(RRRR((s./sys/lib/python2.7/site-packages/nose/proxy.pyRMs      cCs t|jƒS(N(treprR(R((s./sys/lib/python2.7/site-packages/nose/proxy.pyt__repr__UscCskt|dtƒ rgt|dtƒrgt|djtfiƒ|dƒ}|d||df}n|S(Niii(t isinstancet ExceptionttypeR(RterrR((s./sys/lib/python2.7/site-packages/nose/proxy.pyt _prepareErrXs'&c Cszt|jddƒ}||jksv||ksv|t|ddƒksvtd|jt|jƒ|t|ƒfƒ‚dS(NRt _nose_cases4ResultProxy for %r (%s) was called with test %r (%s)(RRRtAssertionErrortid(RRtcase((s./sys/lib/python2.7/site-packages/nose/proxy.pyt assertMyTestbs  cCsL|j|ƒ|jj|jƒt|jdƒrH|jj|jƒndS(Nt afterTest(R+RR,RthasattrR(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyR,ms cCsL|j|ƒ|jj|jƒt|jdƒrH|jj|jƒndS(Nt beforeTest(R+RR.RR-R(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyR.ss cCs½|j|ƒ|j}|j|j|ƒ}|r5dS|j|j|ƒ}|dk r_|}n|j|j|ƒ|jj|j|j|ƒƒ|jj ƒ r¹|j j r¹t |_ ndS(N(R+Rt handleErrorRt formatErrorRtaddErrorRR&t wasSuccessfulRt stopOnErrorRt shouldStop(RRR%Rtplugin_handledt formatted((s./sys/lib/python2.7/site-packages/nose/proxy.pyR1ys    cCs¹|j|ƒ|j}|j|j|ƒ}|r5dSt|j_|j|j|ƒ}|dk rk|}n|j|j|ƒ|j j|j|j |ƒƒ|j j rµt |_ndS(N(R+Rt handleFailureRRtpassedt formatFailureRt addFailureRR&RR3RR4(RRR%RR5R6((s./sys/lib/python2.7/site-packages/nose/proxy.pyR:ˆs      cCszddlm}|j|ƒ|j}t|tƒsDt|ƒ}n|j|j||dfƒ|j j |j|ƒdS(Niÿÿÿÿ(tSkipTest( tnose.plugins.skipR;R+RR"R#R1RRRtaddSkip(RRtreasonR;R((s./sys/lib/python2.7/site-packages/nose/proxy.pyR=—s  cCs7|j|ƒ|jj|jƒ|jj|jƒdS(N(R+Rt addSuccessRR(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyR?¢s cCs7|j|ƒ|jj|jƒ|jj|jƒdS(N(R+Rt startTestRR(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyR@§s cCs|jjƒdS(N(Rtstop(R((s./sys/lib/python2.7/site-packages/nose/proxy.pyRA¬scCs7|j|ƒ|jj|jƒ|jj|jƒdS(N(R+RtstopTestRR(RR((s./sys/lib/python2.7/site-packages/nose/proxy.pyRB¯s RR4sShould the test run stop?terrorssTests that raised an exceptiontfailuressTests that failedttestsRunsNumber of tests runN(RRRRRR!R&R+R,R.R1R:R=R?R@RARBR R4RCRDRE(((s./sys/lib/python2.7/site-packages/nose/proxy.pyRCs,                  ( Rtloggingt nose.configRt getLoggerRtlogR tobjectRR(((s./sys/lib/python2.7/site-packages/nose/proxy.pyts