ó š3ëSc@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:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyR s   cCst|j|j|j|jƒS(N(RRRRR(R((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyt _makeResult(s cCsÑ|jjj|ƒ}|dk r*|}n|jjj|jƒ}|dk rZ||_n|jƒ}tjƒ}y||ƒWntk r“nXtjƒ}|j ƒ|j ||ƒ|jjj |ƒ|S(saOverrides to provide plugin hooks and defer all output to the test result class. N( Rtpluginst prepareTestRtsetOutputStreamRRttimetKeyboardInterruptt printErrorst printSummarytfinalize(Rttesttwrappertwrappedtresulttstarttstop((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyR .s"         N( t__name__t __module__t__doc__tsyststderrRRRR (((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRs    c BseZdZdZd dd d d d d d ed d d„ Zd d„Zd d„Zd„Z d„Z d„Z d „Z d „Z ee ƒ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?tnoseRHR,t __stdout__tstdoutR6tpathtbasenameR3R0t showPluginsR5RRR RtprepareTestLoadert testNamesR R2t workingDirtchdirt createTests(RR3RHt plug_loader((s:/opt/alt/python27/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( RKRLR:RR5t suiteClassR#tloadTestsFromNamesRU(R((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRXµ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(RKRLR4RRRRRRtprepareTestRunnerR R#t wasSuccessfultsuccessR0R,(Rt plug_runnerR&((s:/opt/alt/python27/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(RM(R((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRÛsc_s&|jj||jddƒfƒdS(Nthelpt(RMtappendtpop(Rtargtkw((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyt add_optionÝs(R)R*RRi(((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRbÚs s Plugin %sis score: %ss tinitial_indents tsubsequent_indentis Options:s %ss, s ((ttextwrapRRRtsorttnametscoretjointwrapRctstript addOptionstlenRM(RRlRbtvtptparsertoptsRc((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRSÕ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(RNt __loader__tget_dataR6RQRptdirnamet__file__tAttributeErrortopentreadtcloset isinstancetstrtdecode(tclsRNtldttexttf((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyRJøs    N(R)R*R+RRtTrueRRCR8RZRXRaRSRJt classmethod(((s:/opt/alt/python27/lib/python2.7/site-packages/nose/core.pyR Hs    '   # cOst|ds0      -Ä  !