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_log.pyc

ó
[³XMc@s©dZddlZddlmZmZddlmZmZddlm	Z	m
Z
d„Zdefd„ƒYZ
d	e	jfd
„ƒYZde	jfd„ƒYZdS(
sG
Test the interaction between trial and errors logged during test run.
iÿÿÿÿN(treactorttask(tfailuretlog(tunittesttreportercCs0yddWntk
r+tjƒ}nX|S(s*
    Return a new, realistic failure.
    ii(tZeroDivisionErrorRtFailure(tf((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pytmakeFailures

tMaskcBs'eZdZdejfd„ƒYZRS(s?
    Hide C{MockTest}s from Trial's automatic test finder.
    tMockTestcBs,eZd„Zd„Zd„Zd„ZRS(cCsdS(s/
            Don't log any errors.
            N((tself((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_silent scCstjtƒƒdS(s-
            Log a single error.
            N(RterrR	(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_single%scCs$tjtƒƒtjtƒƒdS(s)
            Log two errors.
            N(RRR	(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_double+scCstjtdd„ƒS(sC
            Log an error in an asynchronous callback.
            icSstjtƒƒS(N(RRR	(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyt<lambda>6s(Rt
deferLaterR(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_inCallback2s(t__name__t
__module__R
RRR(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyRs			(RRt__doc__RtTestCaseR(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyR
stTestObservercBsVeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
RS(	ss
    Tests for L{unittest._LogObserver}, a helper for the implementation of
    L{TestCase.flushLoggedErrors}.
    cCs"tjƒ|_tjƒ|_dS(N(Rt
TestResulttresultRt_LogObservertobserver(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pytsetUp>scCsO|jjid	d6tjƒd6dd6dd6ƒ|j|jjƒgƒdS(
sW
        Test that a standard log message doesn't go anywhere near the result.
        ssome messagetmessagettimeitisErrort-tsystemN(ssome message(RtgotEventRtassertEqualt	getErrors(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_msgCscCsitƒ}|jjid
d6tjƒd6dd6dd6|d6d	d6ƒ|j|jjƒ|gƒd	S(sF
        Test that an observed error gets added to the result
        RRiR R!R"RtwhyN((R	RR#RtNoneR$R%(RR((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyt
test_errorMs	cCsf|jƒ|jjƒ}|j|jjƒgƒ|jt|ƒdƒ|j|djtƒƒdS(sS
        Check that flushing the observer with no args removes all errors.
        iiN(	R)RtflushErrorsR$R%tlent
assertTruetcheckR(Rtflushed((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyt
test_flushYs

cCstjtdƒƒS(Ns
test error(RRtRuntimeError(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyt_makeRuntimeFailuredscCsµ|jƒ|jƒ}|jjtdddtjƒddddd|dd
ƒƒ|jjtƒ}|j	|jj
ƒ|gƒ|j	t|ƒdƒ|j|d	j
tƒƒd
S(sY
        Check that flushing the observer remove all failures of the given type.
        RRR iR"R!RR'iN((R)R1RR#tdictRR(R*RR$R%R+R,R-(RRR.((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_flushByTypehs
'cCsv|jjtƒtƒ}|jjid
d6tjƒd6dd6dd6|d6d	d6ƒ|j|jjƒgƒd	S(sS
        Check that C{_ignoreErrors} actually causes errors to be ignored.
        RRiR R!R"RR'N((	Rt
_ignoreErrorsRR	R#RR(R$R%(RR((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_ignoreErrorsvs	cCs†|jjtƒ|jjƒtƒ}|jjid
d6tjƒd6dd6dd6|d6d	d6ƒ|j|jj	ƒ|gƒd	S(sj
        Check that C{_clearIgnores} ensures that previously ignored errors
        get captured.
        RRiR R!R"RR'N((
RR4Rt
_clearIgnoresR	R#RR(R$R%(RR((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_clearIgnoresƒs
	(RRRRR&R)R/R1R3R5R7(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyR9s		
					
t	LogErrorscBsDeZdZd„Zd„Zd„Zd„Zd„Zd„ZRS(sb
    High-level tests demonstrating the expected behaviour of logged errors
    during tests.
    cCstjƒ|_dS(N(RRR(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyR™scCs|jtƒdS(N(tflushLoggedErrorsR(R((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttearDownœscCsqtjdƒ}||jƒ|jt|jjƒdƒ|j|jjddjtƒ|jjddƒdS(sI
        Test that a logged error gets reported as a test error.
        RiiN(	R
RRR$R+terrorsR,R-R(Rttest((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_singleErrorŸs

 cCs<tjdƒ}||jƒ|jt|jjƒdƒdS(sf
        Test that when two errors get logged, they both get reported as test
        errors.
        RiN(R
RRR$R+R;(RR<((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_twoErrors©s
cCsqtjdƒ}||jƒ|jt|jjƒdƒ|j|jjddjtƒ|jjddƒdS(sS
        Test that errors logged in callbacks get reported as test errors.
        RiiN(	R
RRR$R+R;R,R-R(RR<((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyR²s

 cCsvtjdƒ}tjdƒ}||jƒ||jƒ|jt|jjƒdƒ|j|jjdd|ƒdS(sT
        Check that an error logged in one test doesn't fail the next test.
        RR
iiN(R
RRR$R+R;(Rtt1tt2((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyttest_errorsIsolated¼s

(	RRRRR:R=R>RRA(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyR8“s			
			
(RRttwisted.internetRRttwisted.pythonRRt
twisted.trialRRR	tobjectR
RRR8(((s?/usr/lib/python2.7/dist-packages/twisted/trial/test/test_log.pyt<module>s	Z