�9�c@swdZddlmZddlZddlZddlZddlZddlZddlm Z m
Z
ddlmZddl
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.coreiitTestProgramtmaintruntrun_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__(tselftstreamtdescriptionst 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(RtpluginstprepareTestRtsetOutputStreamRRttimetprintErrorstprintSummarytfinalize(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
cBs�eZdZdZd
dd
d
d
d
d
d
ed
d
d�Zd
d�Zd�Zd�Z d�Z
d�Zd �Ze
e�ZRS(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.cCs�|dkrtj}n|dkr9|j||
�}n|rU|jjd|�n||_||_| |_i}t j
dd!}
|
dkr�|
d
kr�| |d<ntjj
|d|d|d |d
|d||�dS(NtextrapluginsiiiitexittmoduletdefaultTesttargvt
testRunnert
testLoader(ii(ii(Rtostenviront
makeConfigRt
addPluginsRtsuiteR/R+tversion_infoRRR(RR0R1R2R3R4tenvRR9R/Rt
addpluginst
extra_argstversion((s-/sys/lib/python2.7/site-packages/nose/core.pyRcs"
cCsCt�}|r!td|�}n t�}td|d|d|�S(sSLoad a Config, pre-filled with user config files if any are
found.
RR;tfiles(RRRR(RR;Rt cfg_filestmanager((s-/sys/lib/python2.7/site-packages/nose/core.pyR7xs cCs�|jj|d|j��tjd|j�|jjjr�ddlm}t j
t _dtj
jt jd�|fGHt jd�n|jjjr�|j�t jd�n|jdkr�td|j�|_n*t|j�r|jd|j�|_n|jjj|j�}|dk r6||_ntjd|j�|jjrg|jj|_nt|j�|_tjd |j�tjd
|j�|jjdk r�tj|jj�n|j�dS(s>Parse 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/tshowPluginsR4RRR RtprepareTestLoadert testNamesR
R1t
workingDirtchdirtcreateTests(RR2RCtplug_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+(Rtplug_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
dd
��GH|dkr<|�}|j|�t|j
�r<Hd
GHx^|j
D]P\}}ddj|�GH|r�j|j|j
�d ddd��GHq��q<nHqHqHWdS(s)Print list of available plugins.
i�NtDummyParsercBseZd�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\RNREtclassmethod(((s-/sys/lib/python2.7/site-packages/nose/core.pyREs ' # cOst|d<t||�jS(s�Collect and run tests, returning success or failure.
The arguments to `run()` are the same as to `main()`:
* 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`.
* 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.
With the exception that the ``exit`` argument is always set
to False.
R/(tFalseRRZ(RbRc((s-/sys/lib/python2.7/site-packages/nose/core.pyR
s
t__main__cKstd||�dS(s�Collect and run tests in a single module only. Defaults to running
tests in __main__. Additional arguments to TestProgram may be passed
as keyword arguments.
R1N(R(RiRc((s-/sys/lib/python2.7/site-packages/nose/core.pyR&scCs�d}td|�}tdt�d|�}|jd d
g�t|�}|jrj|j|j�}n|jd
�}t||j�S(sTestSuite replacement entry point. Use anywhere you might use a
unittest.TestSuite. The collector will, by default, load options from
all config files and execute loader.loadTestsFromNames() on the
configured testNames, or '.' if no testNames are configured.
treportRRORXRtexcludeR?RR2RR-(R�sprepareTestsprepareTestLoadersprepareTestRunnerssetOutputStream(R-( RRRRDRRPRWRR!(tsetuptools_incompatRtconftloaderR9((s-/sys/lib/python2.7/site-packages/nose/core.pyR.s
(ii(%R*t
__future__RtloggingR5R+RRtnose.configRRtnose.loaderRtnose.plugins.managerRRRtnose.resultRt
nose.suiteRt nose.utilR R
t getLoggerRFR:t compat_24t__all__RRRRR
RRR((((s-/sys/lib/python2.7/site-packages/nose/core.pyt<module>s0 *� !
|