ó J9•Qc@swdZddlmZddlZddlZddlZddlZddlZddlm Z m Z ddl m Z ddl mZmZmZddlmZddlmZdd lmZmZejd ƒZejdkZd ddddddgZdejfd„ƒYZd ejfd„ƒYZeZZ d„Z!dd„Z"d„Z#e$dkrse ƒndS(s,Implements nose test program and collector. iÿÿÿÿ(t generatorsN(tConfigtall_config_files(tdefaultTestLoader(t PluginManagertDefaultPluginManagertRestrictedPluginManager(tTextTestResult(tFinalizingSuiteWrapper(tisclassttolists nose.coreiit TestProgramtmaintruntrun_exitt runmodulet collectortTextTestRunnercBs8eZdZejdddd„Zd„Zd„ZRS(sÉTest runner that uses nose's TextTestResult to enable errorClasses, as well as providing hooks for plugins to override or replace the test output stream, results, and the test case itself. icCs>|dkrtƒ}n||_tjj||||ƒdS(N(tNoneRtconfigtunittestRt__init__(tselftstreamt descriptionst verbosityR((s-/sys/lib/python2.7/site-packages/nose/core.pyR s   cCst|j|j|j|jƒS(N(RRRRR(R((s-/sys/lib/python2.7/site-packages/nose/core.pyt _makeResult(s cCs¹|jjj|ƒ}|dk r*|}n|jjj|jƒ}|dk rZ||_n|jƒ}tjƒ}||ƒtjƒ}|jƒ|j ||ƒ|jjj |ƒ|S(saOverrides to provide plugin hooks and defer all output to the test result class. N( Rtpluginst prepareTestRtsetOutputStreamRRttimet printErrorst printSummarytfinalize(Rttesttwrappertwrappedtresulttstarttstop((s-/sys/lib/python2.7/site-packages/nose/core.pyR .s         N( t__name__t __module__t__doc__tsyststderrRRRR (((s-/sys/lib/python2.7/site-packages/nose/core.pyRs    c BsƒeZdZdZd dd d d d d d ed d d„ Zd d„Zd„Zd„Z d„Z d„Z d „Z e e ƒZ RS( s¾Collect and run tests, returning success or failure. The arguments to TestProgram() are the same as to :func:`main()` and :func:`run()`: * module: All tests are in this module (default: None) * defaultTest: Tests to load (default: '.') * argv: Command line arguments (default: None; sys.argv is read) * testRunner: Test runner instance (default: None) * testLoader: Test loader instance (default: None) * env: Environment; ignored if config is provided (default: None; os.environ is read) * config: :class:`nose.config.Config` instance (default: None) * suite: Suite or list of tests to run (default: None). Passing a suite or lists of tests will bypass all test discovery and loading. *ALSO NOTE* that if you pass a unittest.TestSuite instance as the suite, context fixtures at the class, module and package level will not be used, and many plugin hooks will not be called. If you want normal nose behavior, either pass a list of tests, or a fully-configured :class:`nose.suite.ContextSuite`. * exit: Exit after running tests and printing report (default: True) * plugins: List of plugins to use; ignored if config is provided (default: load plugins with DefaultPluginManager) * addplugins: List of **extra** plugins to use. Pass a list of plugin instances in this argument to make custom plugins available while still using the DefaultPluginManager. it.c Csà|dkrtj}n|dkr9|j|| ƒ}n| rU|jjd| ƒn||_||_| |_i} t j dd!} | d kr«| d kr«| | dParse argv and env and configure running environment. tdocs configured %siÿÿÿÿ(t __version__s %s version %siRstest loader is %ssdefaultTest %ssTest names are %sN(Rt configuretusagetlogtdebugtoptionsR>tnoseRCR+t __stdout__tstdoutR5tpathtbasenameR2R/t showPluginsR4RRR RtprepareTestLoadert testNamesR R1t workingDirtchdirt createTests(RR2RCt plug_loader((s-/sys/lib/python2.7/site-packages/nose/core.pyt parseArgs„s4 "    cCsYtjd|jƒ|jdk r=|jj|jƒ|_n|jj|jƒ|_dS(sÑCreate the tests to run. If a self.suite is set, then that suite will be used. Otherwise, tests will be loaded from the given test names (self.testNames) using the test loader. screateTests called with %sN( RFRGR9RR4t suiteClassR"tloadTestsFromNamesRP(R((s-/sys/lib/python2.7/site-packages/nose/core.pyRS«scCsÄtjdƒ|jdkrLtd|jjd|jjd|jƒ|_n|jjj |jƒ}|dk r|||_n|jj |j ƒ}|j ƒ|_ |jr½tj|j ƒn|j S(soRun Tests. Returns true on success, false on failure, and sets self.success to the same value. srunTests calledRRRN(RFRGR3RRRRRRtprepareTestRunnerR R"t wasSuccessfultsuccessR/R+(Rt plug_runnerR%((s-/sys/lib/python2.7/site-packages/nose/core.pytrunTests¹s     c CsHddl}ddd„ƒY}|jj}|jjjƒx|jjD]ø}d|jGH|dkrHd|jGHdj|j|j ƒj ƒd d d d ƒƒGH|d kr<|ƒ}|j |ƒt |j ƒr<Hd GHx^|j D]P\}}ddj|ƒGH|râdj|j|j ƒd dd dƒƒGHqâqâWq<nHqHqHWdS(s)Print list of available plugins. iÿÿÿÿNt DummyParsercBseZd„Zd„ZRS(cSs g|_dS(N(RH(R((s-/sys/lib/python2.7/site-packages/nose/core.pyRÑsc_s&|jj||jddƒfƒdS(Nthelpt(RHtappendtpop(Rtargtkw((s-/sys/lib/python2.7/site-packages/nose/core.pyt add_optionÓs(R(R)RRd(((s-/sys/lib/python2.7/site-packages/nose/core.pyR]Ðs s Plugin %sis score: %ss tinitial_indents tsubsequent_indentis Options:s %ss, s ((ttextwrapRRRtsorttnametscoretjointwrapR^tstript addOptionstlenRH(RRgR]tvtptparsertoptsR^((s-/sys/lib/python2.7/site-packages/nose/core.pyRNËs2         cCsÄddl}y7|j}|jtjjtjjtƒdƒƒ}WnYtk ržt tjjtjjtƒdƒdƒ}z|j ƒ}Wd|j ƒXnXt |t ƒsÀ|jdƒ}n|S(Niÿÿÿÿs usage.txttrsutf-8(RIt __loader__tget_dataR5RLRktdirnamet__file__tAttributeErrortopentreadtcloset isinstancetstrtdecode(tclsRItldttexttf((s-/sys/lib/python2.7/site-packages/nose/core.pyREîs    N(R(R)R*RRtTrueRR7RURSR\RNREt classmethod(((s-/sys/lib/python2.7/site-packages/nose/core.pyR Es   '   # cOst|ds0      *½  !