Your IP : 172.28.240.42


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


=Nc@svdZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZddlmZdd	lmZdd
lmZmZmZddlmZdefd
YZdejfdYZ dejfdYZ!de!fdYZ"de fdYZ#de#fdYZ$dejfdYZ%de fdYZ&dejfdYZ'dejfdYZ(d ejfd!YZ)d"ejfd#YZ*d$e*fd%YZ+d&ejfd'YZ,d(e,fd)YZ-d*dBd+YZ.d,ejfd-YZ/d.ejfd/YZ0d0e0fd1YZ1d2ejfd3YZ2d4e0fd5YZ3d6ejfd7YZ4d8e1fd9YZ5d:ej6fd;YZ7d<ejfd=YZ8d>efd?YZ9d@ejfdAYZ:dS(Cs&
Tests for L{twisted.trial.reporter}.
iN(tgetmro(tsuppressWarnings(tlog(tFailure(titrialtunittesttrunnertreportertutil(tUncleanWarningsReporterWrapper(t	erroneous(tmakeTodotSkipTesttTodo(tsampletBrokenStreamcBs5eZdZeZeZdZdZdZRS(s
    Stream-ish object that raises a signal interrupt error. We use this to make
    sure that Trial still manages to write what it needs to write.
    cCs
||_dS(N(tfObj(tselfR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt__init__ scCs8|jr|jj|St|_ttjddS(NsInterrupted write(twrittenRtwritetTruetIOErrorterrnotEINTR(Rts((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR#s		cCs5|jr|jjSt|_ttjddS(NsInterrupted flush(tflushedRtflushRRRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR)s	
	(	t__name__t
__module__t__doc__tFalseRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs		t
StringTestcBseZdZRS(cCstd|}|jt|t|kdt|t|fttjd}xtt||D]\}\}}|dkrqrqrt	|t
r|j||d|||fqrt	||r|j|j|d||j
|fqrtd|fqrWdS(Ns2Must have more observed than expectedlines %d < %dtsLine %d: %r not in %rs#Line %d: %r did not match string %rs$don't know what to do with object %r(tfiltertNonet
failUnlesstlenttypetretcompilet	enumeratetzipt
isinstancetstrtassertSubstringtmatchtpatternt	TypeError(RtexpecttoutputtREGEX_PATTERN_TYPEtline_numbertexptout((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytstringComparison1s"((RRR7(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR 0stTestTestResultcBs#eZdZdZdZRS(cCstj|_dS(N(Rt
TestResulttresult(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytsetUpGscCs}ytdWn,tk
r>}|jj|tjnX|jjdd}|j||j|jt|jdS(Ntfooii(	tRuntimeErrorR:taddErrortsystexc_infoterrorstassertEqualtvalueR&(RtexcValuetfailure((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_pyunitAddErrorJscCsy|jdWn/|jk
rD}|jj|tjnX|jjdd}|j||j|j|j|jdS(NR<ii(	tfailureExceptionR:t
addFailureR?R@tfailuresRBRCR&(RRDRE((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_pyunitAddFailureTs(RRR;RFRJ(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR8Fs		
tTestReporterRealtimecBseZdZRS(cCs(tj}tj|dt|_dS(Ntrealtime(tStringIORtReporterRR:(RR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;`s(RRR;(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRK_stTestErrorReportingcBsVeZejdZdZdZdZdZdZ	dZ
dZRS(s^=+$cCs7tj|_tj|_tj|j|_dS(N(Rt
TestLoadertloaderRMR2RRNR:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;hscCs&|j|}|j|jjS(N(t	getResulttdoneR2tgetvalue(RtsuiteR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	getOutputms
cCs|j|j|jS(N(trunR:(RRU((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRRrscCsn|jjtj}|j|j}|jddtjdtjdddg}|j	||dS(s
        A test method which runs and has an error recorded against it is
        reported in the output stream with the I{ERROR} tag along with a summary
        of what error was reported and the ID of the test.
        s[ERROR]s"Traceback (most recent call last):s.^\s+File .*erroneous\.py., line \d+, in setUp$s5^\s+raise FoolishError, .I am a broken setUp method.$sEtwisted.trial.test.erroneous.FoolishError: I am a broken setUp methods9twisted.trial.test.erroneous.TestFailureInSetUp.test_noopN(
RQt	loadClassR
tTestFailureInSetUpRVt
splitlinestdoubleSeparatorR'R(R7(RRUR2R.((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_formatErroredMethodvs	cCsq|jjtjj}|j|j}|jddtj	dtj	dddg}|j
||dS(s
        A test method which runs and has a failure recorded against it is
        reported in the output stream with the I{FAIL} tag along with a summary
        of what failure was reported and the ID of the test.
        s[FAIL]s"Traceback (most recent call last):s2^\s+File .*erroneous\.py., line \d+, in test_fail$s^\s+self\.fail\("I fail"\)$s'twisted.trial.unittest.FailTest: I fails6twisted.trial.test.erroneous.TestRegularFail.test_failN(RQt
loadMethodR
tTestRegularFailt	test_failRVRZR[R'R(R7(RRUR2R.((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_formatFailedMethods	cCsddlm}tj|jj|tj}|j|}d}x*ddd|gD]}|j	||qYW|j
tjd|d|j
tjd	g}|j||jd
S(s
        A problem encountered while running a doctest is reported in the output
        stream with a I{FAIL} or I{ERROR} tag along with a summary of what
        problem was encountered and the ID of the test.
        i(R
s0twisted.trial.test.erroneous.unexpectedExceptions1/0tZeroDivisionErrorsException raised:sFail(ed|ure in) example:s;Couldn't match 'Failure in example: ' or 'Failed example: 's\[(ERROR|FAIL)\]N(ttwisted.trial.testR
RtdecorateRQtloadDoctestsRt	ITestCaseRVR-R$R'tsearchR[R(R7RZ(RR
RUR2tpatht	substringR1((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_doctestErrors	cCstjd}|j|j}|jddtjdtjddd|jddtjd	tjd
tjdtjdd
dg}|j||dS(s-
        Check that errors in C{DelayedCall}s get reported, even if the
        test already has a failure.

        Only really necessary for testing the deprecated style of tests that
        use iterate() directly. See
        L{erroneous.DelayedCall.testHiddenException} for more details.
        ttestHiddenExceptions[FAIL]s"Traceback (most recent call last):s<^\s+File .*erroneous\.py., line \d+, in testHiddenException$sD^\s+self\.fail\("Deliberate failure to mask the hidden exception"\)$sPtwisted.trial.unittest.FailTest: Deliberate failure to mask the hidden exceptions<twisted.trial.test.erroneous.DelayedCall.testHiddenExceptions[ERROR]s^\s+File .* in runUntilCurrents^\s+.*s*^\s+File .*erroneous\.py", line \d+, in gos1^\s+raise RuntimeError\(self.hiddenExceptionMsg\)s*exceptions.RuntimeError: something blew upN(R
tDelayedCallRVRZR[R'R(R7(RttestR2R.((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_hiddenExceptions&		(RRR'R(R[R;RVRRR\R`RiRm(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyROes						t'TestUncleanWarningWrapperErrorReportingcBseZdZdZRS(s
    Tests that the L{UncleanWarningsReporterWrapper} can sufficiently proxy
    IReporter failure and error reporting methods to a L{reporter.Reporter}.
    cCs=tj|_tj|_ttj|j|_dS(N(	RRPRQRMR2R	RRNR:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;s(RRRR;(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRnstTracebackHandlingcBsGeZdZdZdZdZdZdZdZRS(cCstj}tj|}|j||j|j}t|dksPt|dd|ksjt|j|ddj	S(Nii(
RMRRNRWRIRAR%tAssertionErrort_trimFramestframes(RRltstreamR:tbads((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytgetErrorFramess
cCsxt||D]x\}}|j|d|dtjj|ddjtj}|djd}|j|t||qW|jt|t|dS(Niit/(R*RBtosRgtsplitexttsplittsepR%(RtobservedFramestexpectedFramestobservedtexpectedtobservedSegstexpectedSegs((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytcheckFramess&cCs5tjd}|j|}|j|dgdS(NR_stwisted/trial/test/erroneous(s	test_failstwisted/trial/test/erroneous(R
R^RuR(RRlRr((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_basics	cCs8tjd}|j|}|j|ddgdS(Nttest_subfailstwisted/trial/test/erroneoust
subroutine(Rstwisted/trial/test/erroneous(Rstwisted/trial/test/erroneous(R
R^RuR(RRlRr((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_subroutines
	cCs5tjd}|j|}|j|dgdS(NR_t_laterstwisted/trial/test/erroneous(Rstwisted/trial/test/erroneous(R
tTestFailureInDeferredChainRuR(RRlRr((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_deferreds	cCs,tjd}|jg|jgdS(N(RRNR#RBRq(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_noFramesscCs2tjd}|jdg|jdgdS(Ns
fake frame(RRNR#RBRq(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_oneFrames(	RRRuRRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRos								tFormatFailurescBs,eZdZdZdZdZRS(cCsytdWntk
r/t|_nXdddd
gdggddddgdggg|j_tj|_tj|j|_dS(NR<s
foo/bar.pyitxtytorangetquxi
tattwotbtMCMXCIX(Ri(RR(RR(RR(	R=RtfRrRMRsRRNR:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;s
$cCsS|jj|j}|jddtjddtjddg|jdS(Ns"Traceback (most recent call last):s#  File "foo/bar.py", line 5, in foos^\s*$s$  File "foo/bar.py", line 10, in quxsRuntimeError: foo(R:t_formatFailureTracebackRR7R'R(RZ(Rttb((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_formatDefault"scCs2d}d}|jj|}|j||dS(Ns
  File "twisted/trial/unittest.py", line 256, in failUnlessSubstring
    return self.failUnlessIn(substring, astring, msg)
exceptions.TypeError: iterable argument required

s
  File "twisted/trial/unittest.py", line 256, in failUnlessSubstring
    return self.failUnlessIn(substring, astring, msg)
exceptions.TypeError: iterable argument required
(R:RRB(RRR~t	formatted((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_formatString,scCs:|jj}|jj|j|j|jj|dS(N(RRrR:RRB(RRr((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_mutation;s
(RRR;RRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs		
	tPyunitTestNamescBsGeZdZdZdZdZdZdZdZRS(cCs%tj|_tjd|_dS(Nttest_foo(RMRsRt
PyunitTestRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;CscCsEtj|j}|j|j|jj}|j|ddS(Ns2twisted.trial.test.sample.PyunitTest.test_foo ... (RtVerboseTextReporterRst	startTestRlRTRB(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_verboseReporterGs
cCsktj|j}|j|j|jj}|jdj}|j||j	|jddS(Nis ...(
RtTreeReporterRsRRlRTRZtstripRBtgetDescription(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_treeReporterNs
cCs8tj|j}|j|j}|j|ddS(NR(RRRsRRlRB(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_getDescriptionUscCsqtj|j}|jj||j|jjjjd}|j	|ddddddgdS(s
        The summary of L{reporter.MinimalReporter} is a simple list of numbers,
        indicating how many tests ran, how many failed etc.

        The numbers represents:
         * the run time of the tests
         * the number of tests run, printed 2 times for legacy reasons
         * the number of errors
         * the number of failures
         * the number of skips
        t it1t0N(
RtMinimalReporterRsRlRWt
_printSummaryRTRRyRB(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_minimalReporter[s

csddddgtj|j}fd|_|jj||j|jjjj	d}|d}|j
|dd	S(
st
        L{reporter.MinimalReporter} reports the time to run the tests as first
        data in its output.
        g?g333333?g?gffffff?cs
jdS(Ni(tpop((ttimes(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt<lambda>usRis0.7N(RRRst_getTimeRlRWRRTRRyRB(RR:R2ttimer((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_minimalReporterTimens

cCs`tj|j}|j|jjjjd}|j|ddddddgdS(sv
        The summary of L{reporter.MinimalReporter} is a list of zeroes when no
        test is actually run.
        RRN(RRRsRRTRRyRB(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_emptyMinimalReporter}s
(	RRR;RRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRBs						tTestDirtyReactorcBs;eZdZdZdZdZdZdZRS(s
    The trial script has an option to treat L{DirtyReactorAggregateError}s as
    warnings, as a migration tool for test authors. It causes a wrapper to be
    placed around reporters that replaces L{DirtyReactorAggregatErrors} with
    warnings.
    cCsCttjdgdg|_tj|_td|_dS(NR<tbarttest_errorByDefault(RRtDirtyReactorAggregateErrort
dirtyErrorRMR2RRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCsftjd|j}|j|j|j|jt|jd|j|jdd|jdS(sj
        L{DirtyReactorAggregateError}s are reported as errors with the default
        Reporter.
        RsiiN(	RRNR2R>RlRRBR%RA(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCsPttjd|j}|jt|jjtj|j	|j
|jdS(s
        L{DirtyReactorAggregateError}s are reported as warnings when using
        the L{UncleanWarningsReporterWrapper}.
        RsN(R	RRNR2tassertWarnstUserWarningRtgetErrorMessaget__file__R>Rl(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_warningsEnableds
cCsfttjd|j}|jt|jjtj|j	|j
|j|j|jj
gdS(s
        L{DirtyReactorAggregateError}s are I{not} reported as errors if the
        L{UncleanWarningsReporterWrapper} is used.
        RsN(R	RRNR2RRRRRR>RlRBt_originalReporterRA(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_warningsMaskErrorsscCsttjd|j}|j|j|jj|jjdf|j
t|jj
d|j
|jj
ddj|jj|j
|jj
ddj|jjdS(s
        Some annoying stuff can pass three-tuples to addError instead of
        Failures (like PyUnit). The wrapper, of course, handles this case,
        since it is a part of L{twisted.trial.itrial.IReporter}! But it does
        not convert L{DirtyReactorAggregateError} to warnings in this case,
        because nobody should be passing those in the form of three-tuples.
        RsiiN(R	RRNR2R>RlRR&RCR#RBR%RRA(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_dealsWithThreeTupless
(RRRR;RRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs				
tTrialTestNamescBs5eZdZdZdZdZdZRS(cCs%tj|_tjd|_dS(NR(RMRsRtFooTestRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCsRtj|j}|j|j|jj}|j||jjddS(Ns ... (RRRsRRlRTRBtid(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCsktj|j}|j|j|jj}|jdj}|j||j	|jddS(Nis ...(
RRRsRRlRTRZRRBR(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs
cCs/tj|j}|j|j|ddS(sA docstringttest_treeReporterWithDocstringsN(RRRsRBR(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs8tj|j}|j|j}|j|ddS(NR(RRRsRRlRB(RR:R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs(RRR;RRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs
				tTestSkipcBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	s=
    Tests for L{reporter.Reporter}'s handling of skips.
    cCs:tj|_tj|j|_tjd|_dS(NR(RMRsRRNR:RRRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCs
t|jS(sF
        Get the number of skips that happened to a reporter.
        (R%tskips(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	_getSkipsscCs6|jj|jd|j|j|jddS(Nssome reasoni(R:taddSkipRlRBR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_accumulationscCs3|jj|jd|jt|jjdS(Nssome reason(R:RRlRBRt
wasSuccessful(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_successscCs||jj|jd|jj|jjjd}d}|j|j||j	|t
|jddS(s
        The summary of a successful run with skips indicates that the test
        suite passed and includes the number of skips.
        ssome reasonisPASSED s	(skips=1)N(R:RRlRSRsRTRZR$t
startswithRBR%R(RR2tprefix((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_summarys
cCsV|jj|jd|jj|jjjd}|j|jddS(sw
        The output at the end of a test run with skips includes the reasons
        for skipping those tests.
        ssome reasoniN(	R:RRlRSRsRTRZRBR(RR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_basicErrorss
cCsP|jj|jt|jj|jjjd}|j|ddS(s
        Tests can be skipped without specifying a reason by setting the 'skip'
        attribute to True. When this happens, the test output includes 'True'
        as the reason.
        iRN(	R:RRlRRSRsRTRZRB(RR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_booleanSkips
cCsyddWntk
r'}|}nX|jj|j||jjdj|jjjdd!j	}|j
|t|dS(s
        Skips can be raised as errors. When this happens, the error is
        included in the summary at the end of the test suite.
        iis
iiN(t	ExceptionR:RRlRStjoinRsRTRZRRBR,(RteterrorR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_exceptionSkip+s

+(RRRR;RRRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs					
		tUncleanWarningSkipTestcBs eZdZdZdZRS(sh
    Tests for skips on a L{reporter.Reporter} wrapped by an
    L{UncleanWarningsReporterWrapper}.
    cCs#tj|t|j|_dS(N(RR;R	R:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;?s
cCst|jjS(s}
        Get the number of skips that happened to a reporter inside of an
        unclean warnings reporter wrapper.
        (R%RR(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRCs(RRRR;R(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR:s	tTodoTestcBsheZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZRS(s=
    Tests for L{reporter.Reporter}'s handling of todos.
    cCs:tj|_tj|j|_tjd|_dS(NR(RMRsRRNR:RRRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;QscCs
t|jS(sF
        Get the number of todos that happened to a reporter.
        (R%texpectedFailures(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	_getTodosWscCs
t|jS(sU
        Get the number of unexpected successes that happened to a reporter.
        (R%tunexpectedSuccesses(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt_getUnexpectedSuccesses^scCsH|jj|jtttd|j|j|jddS(sh
        L{reporter.Reporter} accumulates the expected failures that it
        is notified of.
        stodo!iN(R:taddExpectedFailureRlRRRRBR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRes
cCsE|jj|jtttd|jt|jjdS(sU
        A test run is still successful even if there are expected failures.
        stodo!N(	R:RRlRRRRBRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRos
cCsU|jj|jtd|jt|jj|j|j|jddS(s
        A test which is marked as todo but succeeds will have an unexpected
        success reported to its result. A test run is still successful even
        when this happens.
        sHeya!iN(R:taddUnexpectedSuccessRlRRBRRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_unexpectedSuccessxscCs|jj|jtttd|jj|jjj	d}d}|j
|j||j|t
|jddS(sz
        The reporter's C{printSummary} method should print the number of
        expected failures that occured.
        ssome reasonisPASSED s(expectedFailures=1)N(R:RRlRRRRSRsRTRZR$RRBR%R(RR2R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs

cCsh|jj|jtttd|jj|jjj	dj
}|j|ddS(sd
        The reporter's L{printErrors} method should include the value of the
        Todo.
        ssome reasonisReason: 'some reason'N(R:RRlRRRRSRsRTRZRRB(RR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs


cCsB|jj|jtttt|jt|jjdS(s
        Booleans CAN'T be used as the value of a todo. Maybe this sucks. This
        is a test for current behavior, not a requirement.
        N(	R:RRlRRRRtassertRaisesRS(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_booleanTodos
cCsyddWntk
r'}|}nX|jj|jt|td|jjdj|jj	j
dj}|jt
||kdS(sk
        The exception for expected failures should be shown in the
        C{printErrors} output.
        iistodo!s
iN(RR:RRlRRRSRRsRTRZRt
assertTrueR,(RRRR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_exceptionTodos


((
RRRR;RRRRRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRLs				
						
tUncleanWarningTodoTestcBs)eZdZdZdZdZRS(sJ
    Tests for L{UncleanWarningsReporterWrapper}'s handling of todos.
    cCs#tj|t|j|_dS(N(RR;R	R:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;s
cCst|jjS(s}
        Get the number of todos that happened to a reporter inside of an
        unclean warnings reporter wrapper.
        (R%RR(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCst|jjS(s
        Get the number of unexpected successes that happened to a reporter
        inside of an unclean warnings reporter wrapper.
        (R%RR(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs(RRRR;RR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs		t
MockColorizercBs eZdZdZdZRS(sQ
    Used by TestTreeReporter to make sure that output is colored correctly.
    cCs
g|_dS(N(R(RRs((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs|jj||fdS(N(Rtappend(Rttexttcolor((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs(RRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs	tTestTreeReportercBseZdZdZdZeeejdej	ejde
ZdZeeejde
ddZdZdZ
d	Zd
ZdZRS(cCsatjd|_tj|_tj|j|_t|j|j_	|jj	j
|_
dS(NR(RRRlRMRsRRR:Rt
_colorizerR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;s
cCs-yddWntk
r(t}nX|S(Nii(RaR(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	makeErrors


cCs|j}|jj||jd\}}|j|j|jj|j|jd|jd\}}|j|j|jj|j|jddS(sh
        Run cleanupErrors and check that the output is correct, and colored
        correctly.
        iscleanup errorsis[ERROR]N(RR:t
cleanupErrorsRRBRtERROR(RRRR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_cleanupErrorstcategorycCsb|jjdddt|jd\}}|j|j|jj|j|jddS(se
        Run upDownError and check that the output is correct and colored
        correctly.
        tmethodiN(R:tupDownErrorR#RRRBRR(RRR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_upDownErrorstmessages)upDownError is deprecated in Twisted 8.0.cCsp|jj|j|jj|j|jd|jjdf|j|jjj	dj
ddS(sw
        The summary in case of success should have a good count of successes
        and be colored properly.
        itPASSEDis
(successes=1)N(R:t
addSuccessRlRSRBRtSUCCESSRsRTRZR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_summaryColoredSuccesss

#cCsytdWn*tk
r<|jj|tjnX|jj|j|jd|jjdf|j|j	j
jdjddS(st
        The summary in case of failure should have a good count of errors
        and be colored properly.
        R<itFAILEDis
(errors=1)N(
R=R:R>R?R@RSRBRtFAILURERsRTRZR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_summaryColoredFailures

#cCs|jddg|jjd|jddg|jjd|jdg|jjd|jg|jjddS(s
        The tree needs to get the segments of the test ID that correspond
        to the module and class that it belongs to.
        sfoo.bartbazsfoo.bar.baz.quxR<Rsfoo.bar.bazN(RBR:t_getPreludeSegments(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_getPrelude.s		cCsytdWnFtk
rX|jj|tj|jj|jtjnXytdWn9tk
rtjd}|jj|tjnX|jj|jj	|jj
|jj}|j|dd||jg|j|dd|gdS(s
        If two different tests have the same error, L{Reporter._groupResults}
        includes them together in one of the tuples in the list it returns.
        R<Rttest_bariiN(
R=R:R>R?R@RlRRRSt
_groupResultsRARRB(Rtextratgrouped((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_groupResults?s
 

	!cCsd}tjd}tjd}tjd}|jjd|df|df|dfg||j|jjdi|jjd6|j	d	6|j	d
6|j	d6dS(
s
        L{Reporter._printResults} uses the results list and formatter callable
        passed to it to produce groups of results to write to its output stream.
        cSst|dS(Ns
(R,(tn((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	formatterZsRRtFOOiisW%(double separator)s
FOO
1

%(first)s
%(second)s
%(double separator)s
FOO
2

%(third)s
sdouble separatortfirsttsecondtthirdN(
RRRR:t
_printResultsRBRsRTt_doubleSeparatorR(RRRRR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_printResultsUs		(



(RRR;RRRRtsuppressRtBrokenTestCaseWarningtDeprecationWarningRRRRRR	(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs"			
						tTestReporterInterfacecBsVeZdZejZdZdZdZdZ	dZ
dZdZRS(ss
    Tests for the bare interface of a trial reporter.

    Subclass this test case and provide a different 'resultFactory' to test
    that a particular reporter implementation will work with the rest of
    Trial.

    @cvar resultFactory: A callable that returns a reporter to be tested. The
        callable must take the same parameters as L{reporter.Reporter}.
    cCsRtjd|_tj|_tj|_|j|jd|j|_	dS(NRt	publisher(
RRRlRMRsRtLogPublisherRt
resultFactoryR:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCs|jt|jjdS(s4
        shouldStop is False to begin with.
        N(RBRR:t
shouldStop(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_shouldStopInitiallyFalsescCs'|jj|jt|jjdS(sG
        shouldStop becomes True soon as someone calls stop().
        N(R:tstopRBRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_shouldStopTrueAfterStops
cCs|jt|jjdS(sS
        wasSuccessful() is True when there have been no results reported.
        N(RBRR:R(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_wasSuccessfulInitiallyTruescCs0|jj|j|jt|jjdS(sg
        wasSuccessful() is True when there have been only successes, False
        otherwise.
        N(R:RRlRBRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt$test_wasSuccessfulTrueAfterSuccessesscCsYyddWn-tk
r;|jj|jtjnX|jt|jjdS(sP
        wasSuccessful() becomes False after errors have been reported.
        iiN(	RaR:R>RlR?R@RBRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt"test_wasSuccessfulFalseAfterErrorss

 cCsay|jdWn0|jk
rC|jj|jtjnX|jt|jj	dS(sR
        wasSuccessful() becomes False after failures have been reported.
        R<N(
tfailRGR:RHRlR?R@RBRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt$test_wasSuccessfulFalseAfterFailuress
 (
RRRRRNRR;RRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR
vs
								tTestReportercBseZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZRS(s8
    Tests for the base L{reporter.Reporter} class.
    cCs)tj|d|_|j|j_dS(Ni(R
R;t_timerRR:(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;s
	cCs|jd7_|jS(Ni(R(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCsr|jj|j|jj|j|j|jjdk|j|jjd|j|jjt	dS(Nii(
R:RRltstopTestRt	_lastTimeRBttestsRunRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_startStops
cCs~|jdt|j}|jd|j|jjd|jjd|jdd|j|jjddS(	sE
        Test that the reporter safely writes to its stream.
        RstHellosHello
is	Hello %s!tWorlds
Hello World!
N(RRRst_writelnRBRTttruncate(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_brokenStreams
cs)fd}jtdt|dS(sI
        L{IReporter.printErrors} was deprecated in Twisted 8.0.
        csjjdS(N(R:tprintErrors((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRss)printErrors is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_printErrorsDeprecatedscs)fd}jtdt|dS(sJ
        L{IReporter.printSummary} was deprecated in Twisted 8.0.
        csjjdS(N(R:tprintSummary((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRss*printSummary is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_printSummaryDeprecatedscs)fd}jtdt|dS(sC
        L{IReporter.write} was deprecated in Twisted 8.0.
        csjjddS(NR!(R:R((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRss#write is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_writeDeprecatedscs)fd}jtdt|dS(sE
        L{IReporter.writeln} was deprecated in Twisted 8.0.
        csjjddS(NR!(R:twriteln((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR
ss%writeln is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_writelnDeprecatedscs)fd}jtdt|dS(sG
        L{IReporter.separator} was deprecated in Twisted 8.0.
        cs
jjS(N(R:t	separator((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRss'separator is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_separatorDeprecatedscs)fd}jtdt|dS(sD
        L{IReporter.stream} was deprecated in Twisted 8.0.
        cs
jjS(N(R:Rs((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR ss$stream is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_streamDeprecatedscs)fd}jtdt|dS(sI
        L{IReporter.upDownError} was deprecated in Twisted 8.0.
        csjjdddddS(N(R:RR#((R(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR+ss)upDownError is deprecated in Twisted 8.0.N(RRR(RR((RsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_upDownErrorDeprecated'sc	Cs}td}d}d}d}|jjd|d|d|d||j|jjd	|||jd
d|fdS(
s
        L{reporter.Reporter} observes warnings emitted by the Twisted log
        system and writes them to its output stream.
        ssome warning textsexceptions.RuntimeWarningspath/to/some/file.pyiGtwarningRtfilenametlinenos%s:%d: %s: %s
t.iN(tRuntimeWarningRtmsgRBRsRTRy(RRRR1R2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_warning2s
cCs|j|jdS(sj
        A warning emitted twice within a single test is only written to the
        stream once.
        N(R6(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_duplicateWarningSuppressedDs
cCs|jd}|jj||jjd|jj|j|jjd|jj|jj||jj||jjd|jj|jdS(sn
        A warning emitted again after a new test has started is written to the
        stream again.
        ttest_warningEmittedForNewTestiN(t	__class__R:RRstseekR#R6R(RRl((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR8Ps



c	Csr|jj|jjd|jj|jjdtddddddd	|j|jj	d
dS(sl
        L{reporter.Reporter} stops observing log events when its C{done} method
        is called.
        iR0ssome messageRsexceptions.RuntimeWarningR1sfile/name.pyR2iR!N(
R:RSRsR:R#RR5R4RBRT(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_stopObservingqs


(RRRR;RRR$R&R(R)R+R-R.R/R6R7R8R;(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs 														!tTestSafeStreamcBseZdZRS(cCsNtj}t|}tj|}|jd|j|jddS(s
        Test that L{reporter.SafeStream} successfully write to its original
        stream even if an interrupt happens during the write.
        R N(RMRRt
SafeStreamRRBRT(RRstbrokentsafe((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	test_safes

(RRR@(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR<stTestSubunitReportercBseZdZejZdZdZdZdZ	dZ
dZdZdZ
d	Zd
ZdZdZd
ZdZdZRS(sx
    Tests for the subunit reporter.

    This just tests that the subunit reporter implements the basic interface.
    cCs/tjdkrtdntj|dS(Ns2Subunit not installed, cannot test SubunitReporter(RtTestProtocolClientR#RR
R;(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;sc	Ostj}tj|}t||||}|j}t|j|||}|j|||j||jjdS(s
        Assert that 'methodName' on L{SubunitReporter} forwards to the
        equivalent method on subunit.

        Checks that the return value from subunit is returned from the
        L{SubunitReporter} and that the reporter writes the same data to its
        stream as subunit does to its own.

        Assumes that the method on subunit has the same name as the method on
        L{SubunitReporter}.
        N(RMRRBtgetattrRTR:RBRs(	Rt
methodNametargstkwargsRst
subunitClientt
subunitReturnt
subunitOutputtreporterReturn((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytassertForwardsToSubunitscCst||d}|dkr"dSxVt|D]H}yt||Wnttfk
r`Pq/X|jt|||q/WdS(s
        Remove 'methodName' from 'klass'.

        If 'klass' does not have a method named 'methodName', then
        'removeMethod' succeeds silently.

        If 'klass' does have a method named 'methodName', then it is removed
        using delattr. Also, methods of the same name are removed from all
        base classes of 'klass', thus removing the method entirely.

        @param klass: The class to remove the method from.
        @param methodName: The name of the method to remove.
        N(RCR#RtdelattrtAttributeErrorR0t
addCleanuptsetattr(RtklassRDRtbase((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytremoveMethodscCs|jtjdyddWn0tk
rQ|jj|jtjdnX|j	j
}|j	jd|jj|j|j	j
}|j
||dS(s
        Some versions of subunit don't have "addExpectedFailure". For these
        versions, we report expected failures as successes.
        RiittodoN(RRRRBRaR:RRlR?R@RsRTR#RRB(RtexpectedFailureOutputt
successOutput((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt.test_subunitWithoutAddExpectedFailureInstalleds
#cCs~|jtjd|jj|jd|jj}|jjd|jj	|j|jj}|j
||dS(sz
        Some versions of subunit don't have "addSkip". For these versions, we
        report skips as successes.
        RtreasoniN(RRRRBR:RRlRsRTR#RRB(Rt
skipOutputRU((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt#test_subunitWithoutAddSkipInstalledscsgfd}||jj_yddWn6tk
rhtj}|jj|j|dnX|j|j|fgdS(s
        Some versions of subunit have "addExpectedFailure". For these
        versions, when we call 'addExpectedFailure' on the test result, we
        pass the error and test through to the subunit client.
        csj||fdS(N(R(RlR(taddExpectedFailureCalls(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRsiiRSN(R:t_subunitRRaR?R@RlRB(RRR@((RZsD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt$test_addExpectedFailurePassedThroughs
csZgfd}||jj_|jj|jd|j|jdfgdS(s
        Some versions of subunit have "addSkip". For these versions, when we
        call 'addSkip' on the test result, we pass the test and reason through
        to the subunit client.
        csj||fdS(N(R(RlRW(taddSkipCalls(sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR
sRWN(R:R[RRlRB(RR((R]sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_addSkipSendsSubunitAddSkips
cCs*|jj|jd|jjdS(s
        The subunit reporter doesn't need to print out a summary -- the stream
        of results is everything. Thus, done() does nothing.
        R!N(R:RSRBRsRT(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_doneDoesNothings
cCs|jd|jdS(sT
        SubunitReporter.startTest() sends the subunit 'startTest' message.
        RN(RKRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt#test_startTestSendsSubunitStartTestscCs|jd|jdS(sR
        SubunitReporter.stopTest() sends the subunit 'stopTest' message.
        RN(RKRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt!test_stopTestSendsSubunitStopTest$scCs|jd|jdS(sV
        SubunitReporter.addSuccess() sends the subunit 'addSuccess' message.
        RN(RKRl(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt%test_addSuccessSendsSubunitAddSuccess+scCsFyddWntk
r+tj}nX|jd|j|dS(sR
        SubunitReporter.addError() sends the subunit 'addError' message.
        iiR>N(RaR?R@RKRl(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt!test_addErrorSendsSubunitAddError2s

cCsNy|jdWn |jk
r3tj}nX|jd|j|dS(sV
        SubunitReporter.addFailure() sends the subunit 'addFailure' message.
        thelloRHN(RRGR?R@RKRl(RRE((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt%test_addFailureSendsSubunitAddFailure=s
cCsjtj}tj|}|j|j|j}|jj|jd|j||j	jdS(s
        SubunitReporter.addFailure() sends the subunit 'addSuccess' message,
        since subunit doesn't model unexpected success.
        RSN(
RMRRBRRlRTR:RRBRs(RRsRGRI((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt/test_addUnexpectedSuccessSendsSubunitAddSuccessHscCsHtjjd}|j|j|jj}|jd|dS(sC
        Load-time errors are reported like normal errors.
        tdoesntexistN(RRPt
loadByNameRWR:RsRTtassertIn(RRlR2((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_loadTimeErrorsUs(RRRRtSubunitReporterRR;RKRRRVRYR\R^R_R`RaRbRcReRfRj(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRAs"																
tTestSubunitReporterNotInstalledcBseZdZdZRS(sD
    Test behaviour when the subunit reporter is not installed.
    cCsQtj}|jtdd|jttj|}|jdt|dS(s
        If subunit is not installed, TestProtocolClient will be None, and
        SubunitReporter will raise an error when you try to construct it.
        RBsSubunit not availableN(	RMtpatchRR#RRRkRBR,(RRsR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_subunitNotInstalledgs(RRRRn(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRlbstTestTimingReportercBseZejZRS((RRRtTimingTextReporterR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRosstLoggingReportercBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	sJ
    Simple reporter that stores the last test that was passed to it.
    cOs#tjj|||d|_dS(N(RRNRR#Rl(RRERF((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR}scCs
||_dS(N(Rl(RRlR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR>scCs
||_dS(N(Rl(RRlRERS((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs
||_dS(N(Rl(RRlRE((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRHscCs
||_dS(N(Rl(RRltskip((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs
||_dS(N(Rl(RRlRS((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs
||_dS(N(Rl(RRl((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs
||_dS(N(Rl(RRl((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs(RRRRR>RRHRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRqxs							tTestAdaptedReportercBszeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZRS(
s
    L{reporter._AdaptedReporter} is a reporter wrapper that wraps all of the
    tests it receives before passing them on to the original reporter.
    cCs|j|_dS(N(tgetWrappedResultt
wrappedResult(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCs
|jS(N(R(RRl((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt_testAdapterscCs#|j|jj|j|dS(N(RBRRlRv(RRuRl((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
assertWrappedscCsy
|WntSXdS(s
        Return a L{Failure} from raising the given exception.

        @param exceptionInstance: The exception to raise.
        @return: L{Failure}
        N(R(RtexceptionInstance((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
getFailures
cCst}tj||jS(N(RqRt_AdaptedReporterRv(RR:((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRts	cCs6|jj||jt|j|j|dS(sG
        C{addError} wraps its test with the provided adapter.
        N(RuR>RyR=Rw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_addErrorscCs6|jj||jt|j|j|dS(sI
        C{addFailure} wraps its test with the provided adapter.
        N(RuRHRyRpRw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_addFailurescCs9|jj||jtd|j|j|dS(sF
        C{addSkip} wraps its test with the provided adapter.
        s	no reasonN(RuRRyRRw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_addSkips"cCs'|jj||j|j|dS(sH
        C{startTest} wraps its test with the provided adapter.
        N(RuRRw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_startTestscCs'|jj||j|j|dS(sG
        C{stopTest} wraps its test with the provided adapter.
        N(RuRRw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt
test_stopTestscCs?|jj||jttd|j|j|dS(sQ
        C{addExpectedFailure} wraps its test with the provided adapter.
        s	no reasonN(RuRRyR=R
Rw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_addExpectedFailures	cCs0|jj|td|j|j|dS(sS
        C{addUnexpectedSuccess} wraps its test with the provided adapter.
        s	no reasonN(RuRR
Rw(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_addUnexpectedSuccesss(RRRR;RvRwRyRtR{R|R}R~RRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRss				
								t
FakeStreamcBs#eZdZedZdZRS(s
    A fake stream which C{isatty} method returns some predictable.

    @ivar tty: returned value of C{isatty}.
    @type tty: C{bool}
    cCs
||_dS(N(ttty(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRscCs|jS(N(R(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pytisattys(RRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRstAnsiColorizerTestscBsVeZdZdZdZdZdZdZdZdZ	dZ
RS(	s/
    Tests for L{reporter._AnsiColorizer}.
    cCstjj|_dS(N(R?tmodulestcopytsavedModules(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR;scCs$tjjtjj|jdS(N(R?RtcleartupdateR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttearDowns
cCs#|jtjjttdS(sq
        L{reporter._AnsiColorizer.supported} returns C{False} if the given
        stream is not a TTY.
        N(tassertFalseRt_AnsiColorizert	supportedRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_supportedStdOutTTYscCs-dtjd<|jtjjtdS(sw
        L{reporter._AnsiColorizer.supported} returns C{False} if the curses
        module can't be imported.
        tcursesN(R#R?RRRRRR(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_supportedNoCursess
cCs|dtfdY}|tjd<|jtjjt|jtjjt|jtjdj	ddS(s
        L{reporter._AnsiColorizer.supported} returns C{True} if
        C{curses.tigetnum} returns more than 2 supported colors. It only tries
        to call C{curses.setupterm} if C{curses.tigetnum} previously failed
        with a C{curses.error}.
        t
fakecursescBs&eZeZdZdZdZRS(icSs|jd7_dS(Ni(R;(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt	setupterm1scSs|jr
dS|jdS(Ni(R;R(RRC((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttigetnum4s	(RRR=RR;RR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyR-s	RiN(
tobjectR?RRRRRRRBR;(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_supportedSetupTerm&s

cCsFdtfdY}|tjd<|jtjjtdS(s
        L{reporter._AnsiColorizer.supported} returns C{False} and doesn't try
        to call C{curses.setupterm} if C{curses.tigetnum} returns something
        different than C{curses.error}.
        RcBseZeZdZRS(cSs
tdS(N(t
ValueError(RRC((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRJs(RRR=RR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRGsRN(RR?RRRRRR(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt test_supportedTigetNumWrongErrorAscCsFdtfdY}|tjd<|jtjjtdS(s
        L{reporter._AnsiColorizer.supported} returns C{False} if
        C{curses.tigetnum} returns less than 2 supported colors.
        RcBseZeZdZRS(cSsdS(Ni((RRC((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRYs(RRR=RR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRVsRN(RR?RRRRRR(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt$test_supportedTigetNumNotEnoughColorQscCs`dtfdY}|tjd<|jtjjt|jtjdj	ddS(s
        L{reporter._AnsiColorizer.supported} returns C{False} if
        C{curses.tigetnum} raises an error, and calls C{curses.setupterm} once.
        RcBs&eZeZdZdZdZRS(icSs|jd7_dS(Ni(R;(R((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRiscSs|jdS(N(R(RRC((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRls(RRR=RR;RR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRes	RiN(
RR?RRRRRRRBR;(RR((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyttest_supportedTigetNumErrors`s
(RRRR;RRRRRRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyRs								((;RRR?RwR'RMtinspectRttwisted.internet.utilsRttwisted.pythonRttwisted.python.failureRt
twisted.trialRRRRRttwisted.trial.reporterR	RbR
ttwisted.trial.unittestRRR
RRRtTestCaseR R8RKRORnRoRRRRRRRRRRR
RR<RARlRoRNRqRsRR(((sD/usr/lib/python2.7/dist-packages/twisted/trial/test/test_reporter.pyt<module>sJ<(t
/-GGKmK ^