Ñò [sæHc @sRdZddklZddkZddkZddkZddklZddkl Z ddk l Z ddk l Z lZlZeieƒZeƒZdefd „ƒYZd eifd „ƒYZd efd „ƒYZdefd„ƒYZdefd„ƒYZdeifd„ƒYZddd„ƒYZddd„ƒYZdS(sê Test Suites ----------- Provides a LazySuite, which is a suite whose test list is a generator function, and ContextSuite, a suite that can run fixtures (setup/teardown functions or methods) for the context that contains its tests. iÿÿÿÿ(t generatorsN(tTest(tConfig(tResultProxyFactory(tisclasst resolve_namettry_runtMixedContextErrorcBseZdZRS(sQError raised when a context suite sees tests from more than one context. (t__name__t __module__t__doc__(((s./usr/lib/python2.6/site-packages/nose/suite.pyRst LazySuitecBsteZdZd d„Zd„Zd„Zd„ZeZd„Zd„Z d„Z d„Z e e e d d ƒZRS( s:A suite that may use a generator as its list of tests cCs|i|ƒdS(sFInitialize the suite. tests may be an iterable or a generator N(t _set_tests(tselfttests((s./usr/lib/python2.6/site-packages/nose/suite.pyt__init__&scCs t|iƒS(N(titert_tests(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyt__iter__+scCs dti|iƒt|ƒfS(Ns<%s tests=generator (%s)>(tunittestt _strclasst __class__tid(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyt__repr__.scCs ti|ƒS(N(tobjectt__hash__(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyR2scCs|ii|ƒdS(N(t _precachetappend(R ttest((s./usr/lib/python2.6/site-packages/nose/suite.pytaddTest7scCs‰tidt|ƒƒ|iotS|idjotSy5|iiƒ}|dj o|ii |ƒtSWnt j onXtS(Ns tests in %s?( tlogtdebugRRtTruettest_generatortNonetFalsetnextRt StopIteration(R R((s./usr/lib/python2.6/site-packages/nose/suite.pyt __nonzero__:s   ccs^tid|iƒx|iD] }|VqW|idjodSx|iD] }|VqKWdS(Nsprecache is %s(RRRR!R"(R R((s./usr/lib/python2.6/site-packages/nose/suite.pyt _get_testsIs   cCs~g|_t|tiƒ}t|ƒo| o|ƒ|_n;|o|i|gƒd|_n|i|ƒd|_dS(N(Rt isinstanceRt TestSuitetcallableR!taddTestsR"(R Rtis_suite((s./usr/lib/python2.6/site-packages/nose/suite.pyR Rs   sbAccess the tests in this suite. Access is through a generator, so iteration may not be repeatable.(N(RR R RRRRt__str__RR&R'R tpropertyR"R(((s./usr/lib/python2.6/site-packages/nose/suite.pyR #s        t ContextSuitecBs¿eZdZeiiZeZeZdddddd„Z d„Z e Z d„Z d„Zd„Zd„Zd„Zd„Zd „Zd „Zd „Zd „Zeeeidd ƒZRS(s4A suite with context. A ContextSuite executes fixtures (setup and teardown functions or methods) for the context containing its tests. The context may be explicitly passed. If it is not, a context (or nested set of contexts) will be constructed by examining the tests in the suite. cCswtid||t|ƒƒ||_||_|djo tƒ}n||_||_t |_ t i ||ƒdS(NsContext suite for %s (%s) (%s)( RRRtcontexttfactoryR"Rtconfigt resultProxyR#thas_runR R(R RR0R1R2R3((s./usr/lib/python2.6/site-packages/nose/suite.pyRss       cCs,dti|iƒt|id|iƒfS(Ns<%s context=%s>R(RRRtgetattrR0(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyRscCs ti|ƒS(N(RR(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyR…scOs|i||ŽS(N(trun(R targtkw((s./usr/lib/python2.6/site-packages/nose/suite.pyt__call__‰scCs tiƒS(s.Hook for replacing error tuple output (tsystexc_info(R ((s./usr/lib/python2.6/site-packages/nose/suite.pyR;ŒscCs |io|i||ƒ|}}n||}}y|iƒWn3tj o ‚n|i||iƒƒdSXz>x7|iD],}|iotidƒPn||ƒq…WWdt |_ y|i ƒWn2tj o ‚n|i||iƒƒnXXdS(s5Run tests in suite inside of suite fixtures. Ntstopping( R3tsetUptKeyboardInterrupttaddErrorR;Rt shouldStopRRR R4ttearDown(R tresulttorigR((s./usr/lib/python2.6/site-packages/nose/suite.pyR6‘s0      cCsOtidt|ƒ|iƒ|ptidt|ƒƒdS|iotidt|ƒƒdS|i}|djodS|i}|oš|ii|gƒ}x\|oT|i ƒ}tid|ƒ||ijoq§ntid|ƒ|i |ƒq§W||ijo|i |ƒq5n|i |ƒt |_tidƒdS(Ns suite %s setUp called, tests: %sssuite %s has no testsssuite %s already set upsancestor %s may need setupsancestor %s does need setupscompleted suite setup( RRRRt was_setupR0R"R1tgettpopt setupContextR (R R0R1t ancestorstancestor((s./usr/lib/python2.6/site-packages/nose/suite.pyR=²s4       cCs|iii|ƒtid||ƒ|io||ii| s$    Bã