Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/scripts/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyc


oUNc@sddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZddlmZddlmZdd	lmZmZmZid
d6d
d
6dd
6dd6dd6dd6ZdZdZdZdZ dZ!dej"e	j#fdYZ"dZ$dZ%dZ&dZ'dZ(dS(iN(tdefer(tapp(tusagetreflecttfailuretversionst	deprecate(tFilePath(tplugin(tspewer(tset(trunnertitrialtreportertdefaulttplaintbrieftemacstverbosetcgitbcCsd}|j|t|}|j|}|dksF|dkr\td|fn|||!jd}i}x|D]|}t|jdkrqn|jd}t|dkrtd||fn|d	j||dj<qW|S(
s

    Accepts a single line in Emacs local variable declaration format and
    returns a dict of all the variables {name: value}.
    Raises ValueError if 'line' is in the wrong format.

    See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
    s-*-is)%r not a valid local variable declarationt;it:is"%r contains invalid declaration %ri(tfindtlentrfindt
ValueErrortsplittstrip(tlinetparentstarttendtitemst	localVarstitemR((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt_parseLocalVariabless 
"cCsht|d}|j|jg}|jx0|D](}yt|SWq8tk
r_q8Xq8WiS(s
    Accepts a filename and attempts to load the Emacs variable declarations
    from that file, simulating what Emacs does.

    See http://www.gnu.org/software/emacs/manual/html_node/File-Variables.html
    tr(tfiletreadlinetcloseR#R(tfilenametftlinesR((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytloadLocalVariables9s


cCs5t|jdd}|dkr(gS|jdS(Nstest-case-namet,(R+tgettNoneR(R(ttestCaseVar((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytgetTestModulesKscCs;tjj|}|jdo:tjj|ddkS(s
    Returns true if 'filename' looks like a file containing unit tests.
    False otherwise.  Doesn't care whether filename exists.
    ttest_is.py(tostpathtbasenamet
startswithtsplitext(R(R4((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt
isTestFileRscCs/tjgtjtjD]}|j^qS(N(RtCompleteListRt
getPluginsRt	IReportertlongOpt(tp((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt_reporterAction\s	tOptionscBseZdejjejdfZdZddgdddgdd	d
gddd
gddHdgdddgddHdgddHdgddHdgdddgdddgddHd ggZ
d!d"d#d$gd%d&dHd'gd(dHd)d*gd+dHd,d-ggZej
d.iejd/d0d1gd26ed+6ejd3d$d!6ejd3d4d%6d5ejd6d3d7d8egZejZdHZdHZd9Zd:Zd;Zd<Zd=Zd>Zd?Zd@Z dAZ!e!Z"dBZ#dCZ$dDZ%dEZ&dFZ'dGZ(RS(Is@%s [options] [[file|package|module|TestCase|testmethod]...]
    isutrial loads and executes a suite of unit tests, obtained from modules, packages and files listed on the command line.thelpthtrterrorstes;realtime errors, print out tracebacks as soon as they occurtdebugtbsYRun tests in the Python debugger. Will load '.pdbrc' from current directory if it exists.sdebug-stacktracestBs2Report Deferred creation and callback stack tracestnopmsFdon't automatically jump into debugger for postmorteming of exceptionssdry-runtnsdo everything but run the testssforce-gcs<Have Trial run gc.collect() before and after each test case.tprofiles#Run tests under the Python profilersunclean-warningss'Turn dirty reactor errors into warningss
until-failuretusRepeat test until it failss
no-recursetNsDon't recurse into packagesshelp-reporterss,Help on available output plugins (reporters)tlogfiletlstest.logs
log file nametrandomtzs2Run tests in random order using the specified seedstemp-directoryt_trial_temps+Path to use as working directory for tests.R
RsKThe reporter to use for this test run.  See --help-reporters for more info.t
optActionsRRRttbformattdescrsrandom seedtextraActionss*.pys/file | module | package | TestCase | testMethodtrepeatcCs!t|d<tjj|dS(Nttests(R
RR>t__init__(tself((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyRVs
cCs2d}t|dj|}d|jfGH|S(sx
        Return a L{FilePath} representing the directory into which coverage
        results should be written.
        tcoveragestemp-directorys!Setting coverage directory to %s.(RtchildR3(RWtcoverdirtresult((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyRZscCs>ddl}|jdddd|_tj|jjdS(s
        Generate coverage information in the I{coverage} file in the
        directory specified by the I{trial-temp} option.
        iNtcountittracei(R]tTracettracertsystsettracetglobaltrace(RWR]((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_coveragescCsztjj|s-tjjd|fdStjj|}t|r_|dj|n|dj	t
|dS(sF
        Filename to grep for test cases (-*- test-case-name)
        sFile %r doesn't exist
NRU(R2R3tisfileR`tstderrtwritetabspathR7taddtupdateR0(RWR(((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_testmodulescCstjtdS(s
        Print an insanely verbose log of everything that happens.  Useful
        when debugging freezes or locks in complex code.
        N(R`RaR	(RW((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_spewscCsQd}|GHx1tjtjD]}dG|jGdG|jGHqWHtjddS(NsTrial's output can be customized using plugins called Reporters. You can
select any of the following reporters using --reporter=<foo>
s   s	i(RR9RR:R;tdescriptionR`texit(RWtsynopsisR<((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_help_reportersscCstjdS(s/
        Disable the garbage collector
        N(tgctdisable(RW((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt
opt_disablegcscCs9yt||d<Wn tk
r4tjdnXdS(s
        Specify the format to display tracebacks with. Valid formats are
        'plain', 'emacs', and 'cgitb' which uses the nicely verbose stdlib
        cgitb.text function
        RQs.tbformat must be 'plain', 'emacs', or 'cgitb'.N(tTBFORMAT_MAPtKeyErrorRt
UsageError(RWtopt((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_tbformats

cCsitjtjtjtjdddddtdd|j	dkrUg|_	n|j	j|dS(s
        Add an extra argument.  (This is a hack necessary for interfacing with
        emacs's `gud'.)  NOTE: This option is deprecated as of Twisted 11.0
        tTwistediitcategoryt
stackleveliN(twarningstwarnRtgetDeprecationWarningStringR>t	opt_extraRtVersiontDeprecationWarningtextraR.tappend(RWtarg((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyR~s
cCsDytjt|Wn&ttfk
r?tjdnXdS(s-
        see sys.setrecursionlimit()
        s-argument to recursionlimit must be an integerN(R`tsetrecursionlimittintt	TypeErrorRRRu(RWR((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_recursionlimits
cCsyt||d<Wn tk
r6tjdnPX|ddkrYtjdn-|ddkrttjd|d<ndS(NRMs/Argument to --random must be a positive integeriid(tlongRRRuttime(RWtoption((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt
opt_randoms

cCsWxP|jdD]?}|tjkrBtjd|fdtndtj|<qWdS(sP
        Fake the lack of the specified modules, separated with commas.
        R,s/Module '%s' already imported, disabling anyway.RyN(RR`tmodulesR{R|tRuntimeWarningR.(RWRtmodule((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytopt_without_modules	

cGs;|dj||jdk	r7|dj|jndS(NRU(RiRR.(RWtargs((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt	parseArgs!scCsbxLtjtjD]8}d|j|jf}|j|krtj|SqWt	j
ddS(Ns%s.%ssVOnly pass names of Reporter plugins to --reporter. See --help-reporters for more info.(RR9RR:RtklassR;RtnamedAnyRRu(RWtnameR<tqual((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt_loadReporterByName's
cCsf|j|d|d<d|kr0d|d<n|drb|dsVtjdntt_ndS(NR
RQRRFRCs+you must specify --debug when using --nopm (RRRutFalseRtDO_POST_MORTEM(RW((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pytpostOptions1s


N()t__name__t
__module__R2R3R4R`targvRntlongdescR.toptFlagst
optParametersRtCompletionsR8R=t
CompleteFilest	CompletertTruetcompDataR
tTreeReportertfallbackReporterRR_RVRZRcRjRkRoRrRwR~topt_xRRRRRR(((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyR>`sd 									
					
						
cCs?|drtjn|ds+|dr;tjtndS(NRCsdebug-stacktraces(RtstartDebugModeRtsetDebuggingR(tconfig((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt_initialDebugSetupAs

cCs+t|}|d}|j|d|S(Ns
no-recurseRU(t
_getLoadertloadByNames(Rtloadertrecurse((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt	_getSuiteJscsrtj}|drUtjj|dfd|_d|dGHn|dsntj|_n|S(NRMcs
jS(N(RM(tx(trandomer(s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt<lambda>Vss$Running tests shuffled with seed %d
s
until-failure(Rt
TestLoaderRMtRandomtseedtsortertDestructiveTestSuitetsuiteFactory(RR((Rs9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyRQs

cCsd}|drtjj}n|dr8tjj}ntj|dd|d|dd|dd|dd	|d
d|dd
|dd|dS(NRCsdry-runR
tmodeRHRKttracebackFormatRQtrealTimeErrorsRAtuncleanWarningssunclean-warningstworkingDirectorystemp-directorytforceGarbageCollectionsforce-gc(R.RtTrialRunnertDEBUGtDRY_RUN(RR((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt_makeRunner^s







cCs$ttjdkr(tjjdnt}y|jWn0tjk
rq}tdtjd|fnXt	|t
|}t|}|dr|j|}n|j
|}|jrtjd|jj}|jdddtd|jjntj|jdS(	Nis--helps%s: %sis
until-failuretshow_missingtsummaryRZ(RR`RRR>tparseOptionsRterrort
SystemExitRRRtrunUntilFailuretrunR_RaR.tresultst
write_resultsRRZR3Rmt
wasSuccessful(RtuettrialRunnertsuitettest_resultR((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyRps&	

	
()R`R2RMRpRR{ttwisted.internetRttwisted.applicationRttwisted.pythonRRRRRttwisted.python.filepathRttwistedRttwisted.python.utilR	ttwisted.python.compatR
t
twisted.trialRRR
RsR#R+R0R7R=R>tReactorSelectionMixinRRRRR(((s9/usr/lib/python2.7/dist-packages/twisted/scripts/trial.pyt<module>s4H(