Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/nose/proxy.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�9�c@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(RtTrueRtpluginstprepareTestResultRRtResultProxy(Rtresultttesttplug_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�Zd	�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
jr�t|_
ndS(N(R+RthandleErrorRtformatErrorRtaddErrorRR&t
wasSuccessfulRtstopOnErrorRt
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
|��|jj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,			
																	(Rtloggingtnose.configRt	getLoggerRtlogR
tobjectRR(((s./sys/lib/python2.7/site-packages/nose/proxy.pyt<module>s	


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].