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

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


�9�c@s�dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
eje�ZdgZdejfd��YZd	ejfd
��YZdefd��YZd
efd��YZdS(s�nose unittest.TestCase subclasses. It is not necessary to subclass these
classes when writing tests; they are used internally by nose.loader.TestLoader
to create test cases from test functions and methods in test classes.
i�N(t
isfunction(tConfig(tFailure(tresolve_namettest_addressttry_runtTestcBs�eZdZeZddd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zeeddd�Zd�Zd
�Zd�ZRS(s�The universal test case wrapper.

    When a plugin sees a test, it will always see an instance of this
    class. To access the actual test case that will be run, access the
    test property of the nose.case.Test instance.
    cCs�t|�std|��n||_|dkr@t�}n||_d|_d|_||_|j	|_	d|_
tjj
|�dS(NsTnose.case.Test called with argument %r that is not callable. A callable is required.(tcallablet	TypeErrorttesttNoneRtconfigttbinfotcapturedOutputtresultProxytpluginstpassedtunittesttTestCaset__init__(tselfR	RR((s-/sys/lib/python2.7/site-packages/nose/case.pyRs
						cOs|j||�S(N(trun(Rtargtkwarg((s-/sys/lib/python2.7/site-packages/nose/case.pyt__call__,scCs/|jj|�}|dk	r"|St|j�S(N(RttestNameR
tstrR	(Rtname((s-/sys/lib/python2.7/site-packages/nose/case.pyt__str__/scCsd|jS(NsTest(%r)(R	(R((s-/sys/lib/python2.7/site-packages/nose/case.pyt__repr__5scCs2y
|j}Wntk
r nX||j�dS(s>Called after test is complete (after result.stopTest)
        N(t	afterTesttAttributeErrorR	(RtresultR((s-/sys/lib/python2.7/site-packages/nose/case.pyR8s


cCs2y
|j}Wntk
r nX||j�dS(s<Called before test is run (before result.startTest)
        N(t
beforeTestRR	(RR R!((s-/sys/lib/python2.7/site-packages/nose/case.pyR!Bs


cCs"tj�\}}}|||fS(s Extract exception info.
        (tsystexc_info(Rtexctexvttb((s-/sys/lib/python2.7/site-packages/nose/case.pyR#LscCs
|jj�S(s0Get a short(er) description of the test
        (R	tid(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR'RscCs0t|jd�r|jj�St|j�SdS(s�Return a round-trip name for this test, a name that can be
        fed back as input to loadTestByName and (assuming the same
        plugin configuration) result in the loading of this test.
        taddressN(thasattrR	R(R(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR(Ws
cCspy|jjSWntk
r!nXy|jjSWntk
rCnXyt|jj�SWntk
rknXdS(N(R	tcontextRt	__class__Rt
__module__R
(R((s-/sys/lib/python2.7/site-packages/nose/case.pyt_contextbs


s-Get the context object of this test (if any).cCs�|jr|j||�}nz[y|j|�|j|�Wn6tk
rU�n#tj�}|j||�nXWd|j|�XdS(sModified run for the test wrapper.

        From here we don't call result.startTest or stopTest or
        addSuccess.  The wrapper calls addError/addFailure only if its
        own setup or teardown fails, or running the wrapped test fails
        (eg, if the wrapped "test" is not callable).

        Two additional methods are called, beforeTest and
        afterTest. These give plugins a chance to modify the wrapped
        test before it is called and do cleanup after it is
        called. They are called unconditionally.
        N(RR!trunTesttKeyboardInterruptR"R#taddErrorR(RR terr((s-/sys/lib/python2.7/site-packages/nose/case.pyRss
	

cCsA|j}|jjj|�}|dk	r3|}n||�dS(s�Run the test. Plugins may alter the test by returning a
        value from prepareTestCase. The value must be callable and
        must accept one argument, the result instance.
        N(R	RRtprepareTestCaseR
(RR R	t	plug_test((s-/sys/lib/python2.7/site-packages/nose/case.pyR.�s
		cCs�|jj|�}|dk	r"|S|j}y|jj�|_Wn;tk
r~y|jj�|_Wqtk
rzqXnXy|jj�}Wnt	k
r�nXy|t
|j�kr�dSWnt	k
r�nX|S(N(RtdescribeTestR
R	t_testMethodDoctstripRt_TestCase__testMethodDoctshortDescriptiont	ExceptionR(RtdescR	((s-/sys/lib/python2.7/site-packages/nose/case.pyR8�s*	



N(t__name__R,t__doc__tFalset__test__R
RRRRRR!R#R'R(R-tpropertyR*RR.R8(((s-/sys/lib/python2.7/site-packages/nose/case.pyRs"				
	
							tTestBasecBs/eZdZeZd�Zd�Zd�ZRS(sBCommon functionality for FunctionTestCase and MethodTestCase.
    cCs
t|�S(N(R(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR'�scCs|j|j�dS(N(R	R(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR.�scCsrt|jd�r|jjS|j�\}}t|dd�}|sUt|�}n|j�jd�dj�S(NtdescriptionR<s
i(	R)R	RAt_descriptorstgetattrR
RR6tsplit(RtfuncRtdoc((s-/sys/lib/python2.7/site-packages/nose/case.pyR8�s
(R;R,R<R=R>R'R.R8(((s-/sys/lib/python2.7/site-packages/nose/case.pyR@�s
		tFunctionTestCasecBs}eZdZeZd	d	e�d	d�Zd�Zd�Z	e
e	d	d	d�Zd�Zd�Z
d�ZeZd�ZRS(
s�TestCase wrapper for test functions.

    Don't use this class directly; it is used internally in nose to
    create test cases for test functions.
    cCs>||_||_||_||_||_tj|�dS(sInitialize the MethodTestCase.

        Required argument:

        * test -- the test function to call.

        Optional arguments:

        * setUp -- function to run at setup.

        * tearDown -- function to run at teardown.

        * arg -- arguments to pass to the test function. This is to support
          generator functions that yield arguments.

        * descriptor -- the function, other than the test, that should be used
          to construct the test name. This is to support generator functions.
        N(R	t	setUpFuncttearDownFuncRt
descriptorR@R(RR	tsetUpttearDownRRJ((s-/sys/lib/python2.7/site-packages/nose/case.pyR�s					cCs-|jdk	rt|j�St|j�SdS(s�Return a round-trip name for this test, a name that can be
        fed back as input to loadTestByName and (assuming the same
        plugin configuration) result in the loading of this test.
        N(RJR
RR	(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR(�s
cCst|jj�S(N(RR	R,(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR-�ss!Get context (module) of this testcCs0|jr|j�nd}t|j|�dS(s=Run any setup function attached to the test function
        tsetupRKRHN(ssetupssetUps	setUpFunc(RHRR	(Rtnames((s-/sys/lib/python2.7/site-packages/nose/case.pyRKs	
cCs0|jr|j�nd}t|j|�dS(s@Run any teardown function attached to the test function
        tteardownRLRIN(ROstearDownstearDownFunc(RIRR	(RRN((s-/sys/lib/python2.7/site-packages/nose/case.pyRL
s	
cCsf|j�\}}t|d�r-|j}n	|j}d|j|f}|rbd||f}n|S(Ntcompat_func_names%s.%ss%s%s(RBR)RPR;R,(RRERR((s-/sys/lib/python2.7/site-packages/nose/case.pyRs	cCs-|jr|j|jfS|j|jfSdS(sfGet the descriptors of the test function: the function and
        arguments that will be used to construct the test name. In
        most cases, this is the function itself and no arguments. For
        tests generated by generator functions, the original
        (generator) function and args passed to the generated function
        are returned.
        N(RJRR	(R((s-/sys/lib/python2.7/site-packages/nose/case.pyRB%s	N(R;R,R<R=R>R
ttupleRR(R-R?R*RKRLRRRB(((s-/sys/lib/python2.7/site-packages/nose/case.pyRG�s	
							
tMethodTestCasecBszeZdZeZd	e�d	d�Zd�ZeZ	d�Z
d�Zeed	d	d�Z
d�Zd�Zd�ZRS(
s�Test case wrapper for test methods.

    Don't use this class directly; it is used internally in nose to
    create test cases for test methods.
    cCs�||_||_||_||_t|�r?td��n|j|_|j�|_|jdkr�|jj
}t|j|�|_ntj
|�dS(s�Initialize the MethodTestCase.

        Required argument:

        * method -- the method to call, may be bound or unbound. In either
          case, a new instance of the method's class will be instantiated to
	  make the call.  Note: In Python 3.x, if using an unbound method, you
	  must wrap it using pyversion.unbound_method.

        Optional arguments:

        * test -- the test function to call. If this is passed, it will be
          called instead of getting a new bound method of the same name as the
          desired method from the test instance. This is to support generator
          methods that yield inline functions.

        * arg -- arguments to pass to the test function. This is to support
          generator methods that yield arguments.

        * descriptor -- the function, other than the test, that should be used
          to construct the test name. This is to support generator methods.
        s_Unbound methods must be wrapped using pyversion.unbound_method before passing to MethodTestCaseN(tmethodR	RRJRt
ValueErrortim_classtclstinstR
R;RCR@R(RRSR	RRJtmethod_name((s-/sys/lib/python2.7/site-packages/nose/case.pyR;s				cCsr|j�\}}t|d�r-|j}n	|j}d|jj|jj|f}|rnd||f}n|S(NRPs%s.%s.%ss%s%s(RBR)RPR;RVR,(RRERR((s-/sys/lib/python2.7/site-packages/nose/case.pyR_s		
cCs-|jdk	rt|j�St|j�SdS(s�Return a round-trip name for this test, a name that can be
        fed back as input to loadTestByName and (assuming the same
        plugin configuration) result in the loading of this test.
        N(RJR
RRS(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR(ms
cCs|jS(N(RV(R((s-/sys/lib/python2.7/site-packages/nose/case.pyR-wss Get context (class) of this testcCst|jd�dS(NRMRK(ssetupssetUp(RRW(R((s-/sys/lib/python2.7/site-packages/nose/case.pyRK|scCst|jd�dS(NRORL(steardownstearDown(RRW(R((s-/sys/lib/python2.7/site-packages/nose/case.pyRLscCs-|jr|j|jfS|j|jfSdS(sgGet the descriptors of the test method: the method and
        arguments that will be used to construct the test name. In
        most cases, this is the method itself and no arguments. For
        tests generated by generator methods, the original
        (generator) method and args passed to the generated method 
        or function are returned.
        N(RJRRS(R((s-/sys/lib/python2.7/site-packages/nose/case.pyRB�s	N(R;R,R<R=R>R
RQRRRR(R-R?R*RKRLRB(((s-/sys/lib/python2.7/site-packages/nose/case.pyRR3s$		
				(R<tloggingR"RtinspectRtnose.configRtnose.failureRt	nose.utilRRRt	getLoggerR;tlogt__all__RRR@RGRR(((s-/sys/lib/python2.7/site-packages/nose/case.pyt<module>s	�b

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.