Ñò óòGc @sàdZddkZddkZddkZddklZddklZddkl Z l Z l Z ei e ƒZdgZdeifd„ƒYZdeifd „ƒYZd efd „ƒ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(tConfig(tFailure(t resolve_namet test_addressttry_runtTestcBs¤eZdZeZddd„Zd„Zd„Zd„Z d„Z d„Z d„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|ƒptd|ƒ‚n||_|djo tƒ}n||_d|_d|_||_|i |_ t i i |ƒdS(NsTnose.case.Test called with argument %r that is not callable. A callable is required.( tcallablet TypeErrorttesttNoneRtconfigttbinfotcapturedOutputt resultProxytpluginstunittesttTestCaset__init__(tselfRR R ((s-/usr/lib/python2.6/site-packages/nose/case.pyRs         cOs|i||ŽS(N(trun(Rtargtkwarg((s-/usr/lib/python2.6/site-packages/nose/case.pyt__call__*scCs1|ii|ƒ}|dj o|St|iƒS(N(RttestNameR tstrR(Rtname((s-/usr/lib/python2.6/site-packages/nose/case.pyt__str__-s cCs d|iS(NsTest(%r)(R(R((s-/usr/lib/python2.6/site-packages/nose/case.pyt__repr__3scCs4y |i}Wntj onX||iƒdS(s<Called before test is run (before result.startTest) N(t afterTesttAttributeErrorR(RtresultR((s-/usr/lib/python2.6/site-packages/nose/case.pyR6s  cCs4y |i}Wntj onX||iƒdS(s>Called after test is complete (after result.stopTest) N(t beforeTestRR(RRR((s-/usr/lib/python2.6/site-packages/nose/case.pyR@s  cCs"tiƒ\}}}|||fS(s Extract exception info. (tsystexc_info(Rtexctexvttb((s-/usr/lib/python2.6/site-packages/nose/case.pyR!JscCs |iiƒS(s0Get a short(er) description of the test (Rtid(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR%PscCs2t|idƒo|iiƒSt|iƒ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(thasattrRR&R(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR&Usc Csvy|iiSWntj onXy|iiSWntj onXyt|iiƒSWntj onXdS(N(RtcontextRt __class__Rt __module__R (R((s-/usr/lib/python2.6/site-packages/nose/case.pyt_context`ss-Get the context object of this test (if any).c Cs’|io|i||ƒ}nz]y|i|ƒ|i|ƒWn8tj o ‚n$tiƒ}|i||ƒnXWd|i|ƒ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(R RtrunTesttKeyboardInterruptR R!taddErrorR(RRterr((s-/usr/lib/python2.6/site-packages/nose/case.pyRqs   cCsC|i}|iii|ƒ}|dj o |}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(RR RtprepareTestCaseR (RRRt plug_test((s-/usr/lib/python2.6/site-packages/nose/case.pyR,Œs    cCsÈ|ii|ƒ}|dj o|S|iiƒ}|dj o|S|i}y |i}Wn6tj o*y |i}Wq”tj oq”XnX|dj o#|iƒi dƒdiƒ}n|S(Ns i( Rt describeTestR RtshortDescriptiont_testMethodDocRt_TestCase__testMethodDoctstriptsplit(RtdesctdocR((s-/usr/lib/python2.6/site-packages/nose/case.pyR3—s"       #N(t__name__R*t__doc__tFalset__test__R RRRRRRR!R%R&R+tpropertyR(RR,R3(((s-/usr/lib/python2.6/site-packages/nose/case.pyRs"          tTestBasecBs/eZdZeZd„Zd„Zd„ZRS(sBCommon functionality for FunctionTestCase and MethodTestCase. cCs t|ƒS(N(R(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR%²scCs|i|iŒdS(N(RR(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR,µscCsvt|idƒo |iiS|iƒ\}}t|ddƒ}|pt|ƒ}n|iƒidƒdiƒS(Nt descriptionR;s i( R'RR@t _descriptorstgetattrR RR6R7(RtfuncRR9((s-/usr/lib/python2.6/site-packages/nose/case.pyR3¸s (R:R*R;R<R=R%R,R3(((s-/usr/lib/python2.6/site-packages/nose/case.pyR?­s   tFunctionTestCasecBs}eZdZeZd d eƒd d„Zd„Zd„Z e e d d dƒZ d„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>||_||_||_||_||_ti|ƒ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(Rt setUpFunct tearDownFuncRt descriptorR?R(RRtsetUpttearDownRRG((s-/usr/lib/python2.6/site-packages/nose/case.pyRÊs      cCs/|idj ot|iƒSt|iƒ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(RGR RR(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR&æscCst|iiƒS(N(RRR*(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR+ðss!Get context (module) of this testcCs2|io|iƒnd}t|i|ƒdS(s=Run any setup function attached to the test function tsetupRHREN(RJssetUps setUpFunc(RERR(Rtnames((s-/usr/lib/python2.6/site-packages/nose/case.pyRHõs cCs2|io|iƒnd}t|i|ƒdS(s@Run any teardown function attached to the test function tteardownRIRFN(RLstearDowns tearDownFunc(RFRR(RRK((s-/usr/lib/python2.6/site-packages/nose/case.pyRIþs cCsj|iƒ\}}t|dƒo |i}n |i}d|i|f}|od||f}n|S(Ntcompat_func_names%s.%ss%s%s(RAR'RMR:R*(RRCRR((s-/usr/lib/python2.6/site-packages/nose/case.pyRs  cCs/|io|i|ifS|i|ifSdS(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(RGRR(R((s-/usr/lib/python2.6/site-packages/nose/case.pyRAs N(R:R*R;R<R=R ttupleRR&R+R>R(RHRIRRRA(((s-/usr/lib/python2.6/site-packages/nose/case.pyRDÂs      tMethodTestCasecBszeZdZeZd eƒd d„Zd„ZeZ d„Z d„Z e e d 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…||_||_||_||_|i|_|iƒ|_|idjo%|ii}t |i|ƒ|_nt i |ƒdS(sEInitialize 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. 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. N( tmethodRRRGtim_classtclstinstR R:RBR?R(RRPRRRGt method_name((s-/usr/lib/python2.6/site-packages/nose/case.pyR,s      cCsv|iƒ\}}t|dƒo |i}n |i}d|ii|ii|f}|od||f}n|S(NRMs%s.%s.%ss%s%s(RAR'RMR:RRR*(RRCRR((s-/usr/lib/python2.6/site-packages/nose/case.pyRMs     cCs/|idj ot|iƒSt|iƒ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(RGR RRP(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR&[scCs|iS(N(RR(R((s-/usr/lib/python2.6/site-packages/nose/case.pyR+ess Get context (class) of this testcCst|idƒdS(NRJRH(ssetupssetUp(RRS(R((s-/usr/lib/python2.6/site-packages/nose/case.pyRHjscCst|idƒdS(NRLRI(steardownstearDown(RRS(R((s-/usr/lib/python2.6/site-packages/nose/case.pyRImscCs/|io|i|ifS|i|ifSdS(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(RGRRP(R((s-/usr/lib/python2.6/site-packages/nose/case.pyRAps N(R:R*R;R<R=R RNRRRR&R+R>R(RHRIRA(((s-/usr/lib/python2.6/site-packages/nose/case.pyRO$s!      (R;tloggingR Rt nose.configRt nose.failureRt nose.utilRRRt getLoggerR:tlogt__all__RRR?RDRO(((s-/usr/lib/python2.6/site-packages/nose/case.pyts    ›b