Ńň š}ęGc@s“dZddklZddkZddkZddklZddklZddk l Z l Z l Z l Z lZlZyddklZWn#ej oddklZnXddkZeieƒZyddkZeiWn+eefj oddkiiZnXeiZdefd „ƒYZee_d efd „ƒYZ d eifd „ƒYZdei!fd„ƒYZ!d„Z"dS(sŮUse the Doctest plugin with --with-doctest or the NOSE_WITH_DOCTEST environment variable to enable collection and execution of doctests. doctest_ tests are usually included in the tested package, not grouped into packages or modules of their own. For this reason, nose will try to detect and run doctest tests only in the non-test packages it discovers in the working directory. Doctests may also be placed into files other than python modules, in which case they can be collected and executed by using the --doctest-extension switch or NOSE_DOCTEST_EXTENSION environment variable to indicate which file extension(s) to load. doctest tests are run like any other test, with the exception that output capture does not work, because doctest does its own output capture in the course of running a test. This module also includes a specialized version of nose.run() that makes it easier to write doctests that test test runs. .. _doctest: http://docs.python.org/lib/module-doctest.html i˙˙˙˙(t generatorsN(t getmodule(tPlugin(tanypt getpackaget test_addresst resolve_nametsrcttolist(tStringIOtNoseOutputRedirectingPdbcBs#eZd„Zd„Zd„ZRS(cCst|_ti||ƒdS(N(tFalset(_NoseOutputRedirectingPdb__debugger_usedt_orpt__init__(tselftout((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR7s cCs&t|_ti|tiƒiƒdS(N(tTrueR R t set_tracetsyst _getframetf_back(R((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR;s cCs|ioti|ƒndS(N(R R t set_continue(R((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR?s (t__name__t __module__RRR(((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR 6s  tDoctestcBsYeZdZdZeid„Zd„Zd„Z d„Z d„Z d„Z d„Z RS( sO Activate doctest plugin to find and run doctests in non-test modules. c Csšti|||ƒ|idddddd|idƒdd ƒ|id dd dd dd ƒ|idƒ}|dj o|id t|ƒƒndS(Ns--doctest-teststactiont store_truetdestt doctest_teststdefaulttNOSE_DOCTEST_TESTSthelpsĄAlso look for doctests in test modules. Note that classes, methods and functions should have either doctests or non-doctest tests, not both. [NOSE_DOCTEST_TESTS]s--doctest-extensiontappendtdoctestExtensionsLAlso look for doctests in files with this extension [NOSE_DOCTEST_EXTENSION]tNOSE_DOCTEST_EXTENSION(Rtoptionst add_optiontgettNonet set_defaultsR(Rtparsertenvt env_setting((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR$Ms cCsDti|||ƒ|i|_t|iƒ|_tiƒ|_dS(N( Rt configureRRR"t extensiontdoctestt DocTestFindertfinder(RR$tconfig((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR,as ccsÂ|i|iƒptid|ƒdSy|ii|ƒ}Wntj odSX|pdS|iƒt|i ƒ}xA|D]9}|i pqn|i p ||_ nt |ƒVqWdS(NsDoctest doesn't want module %s( tmatchesRtlogtdebugR0tfindtAttributeErrortsortRt__file__texamplestfilenamet DocTestCase(Rtmodulettestst module_filettest((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytloadTestsFromModulegs$    c csź|ioŽt|i|iƒo˜tii|ƒ}t|ƒ}z|iƒ}Wd|iƒXt i ƒ}|i |dh|d6d|d|ddƒ}|i ot |ƒVq¸tVndS(NtglobsR8tnameR:tlinenoi(R-RtendswithtostpathtbasenametopentreadtcloseR.t DocTestParsert get_doctestR9t DocFileCaseR (RR:RBtdhtdocR)R?((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytloadTestsFromFile|s     ccsl|ii|dt|ƒƒ}|oCx@|D]4}t|iƒdjoq,nt|d|ƒVq,WndS(sbLook for doctests in the given object, which will be a function, method or class. R<itobjN(R0R5RtlenR9R;(RRQtparenttdoctestsR?((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytmakeTestsc CsŔ|djotS|ip^|iii|ƒ pG|iio€tdg}|iiD]}||i|ƒqW~ƒoF|ii p8tdg}|iiD]}||i|ƒqŸ~ƒ S(s8Doctest wants only non-test modules in general. s __init__.pyN( R Rtconft testMatchtsearchtincludetfilterR'texclude(RRBt_[1]tinct_[2]texc((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR2˜s ! -cCs‡|idƒotS|iodt|i|iƒoN|ii p;tdg}|iiD]}||i|ƒqZ~ƒ otSdS(Ns.py( RDRR-RRVR[RZR'RX(RtfileR\R_((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytwantFileŞs .N(RRt__doc__R'R-REtenvironR$R,R@RPRUR2Ra(((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyRGs    R;cBsPeZdZdddddd„Zd„Zd„Zd„ZeZd„Z RS(s'Overrides DocTestCase to provide an address() method that returns the correct address for the doctest case. To provide hints for address(), an obj may also be passed -- this will be used as the test object for purposes of determining the test address, if it is provided. ic Cs;||_tt|ƒi|d|ddddddƒdS(Nt optionflagstsetUpttearDowntchecker(t _nose_objtsuperR;RR'(RR?RdReRfRgRQ((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyRŔs cCs4|idj ot|iƒStt|iiƒƒS(N(RhR'RRt_dt_testRB(R((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytaddressÇscCs]|ii}|ii}|dj o4t|ƒ}|i|ƒpd||f}qYn|S(Ns%s.%s(RjRBR:R'Rt startswith(RRBR:tpk((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytidĎs    cCs:|iƒ}|idƒ}d|ddi|d ƒfS(Nt.s%s (%s)i˙˙˙˙(Rntsplittjoin(RRB((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyt__repr__Řs cCsd|iƒS(Ns Doctest: %s(Rn(R((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pytshortDescriptionŢsN( RRRbR'RRkRnRrt__str__Rs(((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyR;šs   RMcBseZdZd„ZRS(sfOverrides to provide address() method that returns the correct address for the doc file case. cCs|iiddfS(N(RjR:R'(R((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyRkćs(RRRbRk(((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyRMâscOsFddk}|iddtddƒddkl}|||ŽdS(s2DEPRECATED: moved to nose.plugins.plugintest. i˙˙˙˙NsLrun() has been moved to nose.plugins.plugintest. Please update your imports.tcategoryt stackleveli(trun(twarningstwarntDeprecationWarningtnose.plugins.plugintestRw(targtkwRxRw((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyRwęs   (#Rbt __future__RtloggingREtinspectRtnose.plugins.baseRt nose.utilRRRRRRt cStringIOR t ImportErrorRt getLoggerRR3R.R;R6tnose.ext.dtcompattexttdtcompatt_OutputRedirectingPdbR R RRMRw(((s9/usr/lib/python2.6/site-packages/nose/plugins/doctests.pyts0  .     r)