Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/unittest/
Upload File :
Current File : //usr/lib/python2.7/unittest/main.pyc

ó
—|_c@s”dZddlZddlZddlZddlmZmZddlmZe	Z
dZdZdZ
d	Zd
Zdefd„ƒYZeZdS(
sUnittest main programiÿÿÿÿNi(tloadertrunner(tinstallHandlers)  -f, --failfast   Stop on first failure
s7  -c, --catch      Catch control-C and display results
s=  -b, --buffer     Buffer stdout and stderr during test runs
s»Usage: %(progName)s [options] [tests]

Options:
  -h, --help       Show this message
  -v, --verbose    Verbose output
  -q, --quiet      Minimal output
%(failfast)s%(catchbreak)s%(buffer)s
Examples:
  %(progName)s test_module               - run tests from test_module
  %(progName)s module.TestClass          - run tests from module.TestClass
  %(progName)s module.Class.test_method  - run specified test method

[tests] can be a list of any number of test modules, classes and test
methods.

Alternative Usage: %(progName)s discover [options]

Options:
  -v, --verbose    Verbose output
%(failfast)s%(catchbreak)s%(buffer)s  -s directory     Directory to start discovery ('.' default)
  -p pattern       Pattern to match test files ('test*.py' default)
  -t directory     Top level directory of project (default to
                   start directory)

For test discovery all test modules must be importable from the top
level directory of the project.
s1Usage: %(progName)s [options] [test] [...]

Options:
  -h, --help       Show this message
  -v, --verbose    Verbose output
  -q, --quiet      Minimal output
%(failfast)s%(catchbreak)s%(buffer)s
Examples:
  %(progName)s                               - run default set of tests
  %(progName)s MyTestSuite                   - run suite 'MyTestSuite'
  %(progName)s MyTestCase.testSomething      - run MyTestCase.testSomething
  %(progName)s MyTestCase                    - run all 'test*' test methods
                                               in MyTestCase
tTestProgramcBs†eZdZeZd	ZZZZ	dd	d	d	e
jedd	d	d	d„
Z
d	d„Zd„Zd„Ze
jd„Zd„ZRS(
sA command-line program that runs a set of tests; this is primarily
       for making test modules conveniently executable.
    t__main__icCsñt|tƒrTt|ƒ|_x<|jdƒdD]}t|j|ƒ|_q2Wn	||_|dkrutj}n||_	||_
|	|_||_|
|_
||_||_||_tjj|dƒ|_|j|ƒ|jƒdS(Nt.ii(t
isinstancet
basestringt
__import__tmoduletsplittgetattrtNonetsystargvtexittfailfastt
catchbreakt	verbositytbuffertdefaultTestt
testRunnert
testLoadertostpathtbasenametprogNamet	parseArgstrunTests(tselfR	RRRRRRRRRtpart((s#/usr/lib/python2.7/unittest/main.pyt__init__Hs$									
cCs¤|r|GHni|jd6dd6dd6dd6}|jtkrOt|d<n|jtkrkt|d<n|jtkr‡t|d<n|j|GHt	j
dƒdS(NRtRRRi(RRtFalsetFAILFASTRt
CATCHBREAKRtBUFFEROUTPUTtUSAGER
R(Rtmsgtusage((s#/usr/lib/python2.7/unittest/main.pyt	usageExitas



c	Cst|ƒdkr=|djƒdkr=|j|dƒdSddl}ddddd	d
g}y}|j|dd|ƒ\}}xÛ|D]Ó\}}|dkr¯|jƒn|dkrÇd|_n|dkrßd|_n|dkr	|jdkr	t|_q	n|dkr3|j	dkr3t|_	q3n|d krŠ|j
dkr]t|_
q]qŠqŠWt|ƒdkrŽ|jdkrŽd|_nEt|ƒdkrÄ||_t
dkrÓd|_qÓn|jf|_|jƒWn#|jk
r}|j|ƒnXdS(!NitdiscoveriiÿÿÿÿthelptverbosetquietRtcatchRthHvqfcbs-hs-Hs--helps-qs--quietis-vs	--verboses-fs
--failfasts-cs--catchs-bs--bufferR(s-hs-Hs--help(s-qs--quiet(s-vs	--verbose(s-fs
--failfast(s-cs--catch(s-bs--buffer(tlentlowert
_do_discoverytgetoptR(RRRtTrueRRRt	testNamest__name__R	tcreateTeststerror(	RRR2t	long_optstoptionstargstopttvalueR&((s#/usr/lib/python2.7/unittest/main.pyRosB(
!	cCsL|jdkr*|jj|jƒ|_n|jj|j|jƒ|_dS(N(R4RRtloadTestsFromModuleR	ttesttloadTestsFromNames(R((s#/usr/lib/python2.7/unittest/main.pyR6™sc
Csƒd|j|_ddl}|jƒ}|j|_|jdddddtdd	d
dƒ|jtkr–|jdd
dddtddd
dƒn|jtkrÐ|jdddddtddd
dƒn|jtkr
|jdddddtddd
dƒn|jddddddddƒ|jdddddd dd!ƒ|jd"d#dd$dddd%ƒ|j
|ƒ\}}t|ƒd&kr¤|jƒnx-t
d(|ƒD]\}}t|||ƒq´W|jdkrò|j|_n|jdkr|j|_n|jdkr.|j|_n|jrCd'|_n|j}	|j}
|j}|ƒ}|j|	|
|ƒ|_dS()Ns%s discoveriÿÿÿÿs-vs	--verbosetdestR+tdefaultR*sVerbose outputtactiont
store_trues-fs
--failfastRsStop on first fail or errors-cs--catchRs'Catch ctrl-C and display results so fars-bs--bufferRs%Buffer stdout and stderr during testss-ss--start-directorytstartRs*Directory to start discovery ('.' default)s-ps	--patterntpatternstest*.pys+Pattern to match tests ('test*.py' default)s-ts--top-level-directoryttops<Top level directory of project (defaults to start directory)ii(sstartspatternstop(RtoptparsetOptionParsertprogt
add_optionR!RRRRt
parse_argsR/R(tziptsetattrR+RRDRERFR)R>(
RRtLoaderRGtparserR9R:tnameR<t	start_dirREt
top_level_dirR((s#/usr/lib/python2.7/unittest/main.pyR1 sT




					cCsß|jrtƒn|jdkr1tj|_nt|jttj	fƒršy+|jd|j
d|jd|jƒ}Wq£t
k
r–|jƒ}q£Xn	|j}|j|jƒ|_|jrÛtj|jjƒƒndS(NRRR(RRRRRtTextTestRunnerRttypettypest	ClassTypeRRRt	TypeErrortrunR>tresultRR
t
wasSuccessful(RR((s#/usr/lib/python2.7/unittest/main.pyRÕs	
	
		N(R5t
__module__t__doc__tUSAGE_FROM_MODULER%RRRRRRtdefaultTestLoaderR3RR(RR6t
TestLoaderR1R(((s#/usr/lib/python2.7/unittest/main.pyR?s			*	5(R\R
RRUR RRtsignalsRR3t
__unittestR"R#R$t
USAGE_AS_MAINR]tobjectRtmain(((s#/usr/lib/python2.7/unittest/main.pyt<module>sª