403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/twisted/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyc
ó
ê=Nc@sdZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZmZm
Z
ddlmZddlmZdefd„ƒYZejeƒd	ejfd
„ƒYZdejfd„ƒYZd
ejfd„ƒYZdS(s(
Tests for L{twisted.python.threadpool}
iÿÿÿÿN(tunittesttutil(t
threadpoolt
threadabletfailuretcontext(treactor(tDeferredtSynchronizationcBs)eZdZd„Zd„ZdgZRS(icCs.||_||_tjƒ|_g|_dS(N(tNtwaitingt	threadingtLocktlocktruns(tselfR	R
((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt__init__s		cCsª|jjtƒrEt|jƒds5tjdƒn|jjƒn|jd7_|jjƒ|jj	dƒt|jƒ|jkr™|jjƒn|jjƒdS(Nig-Cëâ6*?i(
R
tacquiretFalsetlenRttimetsleeptreleasetfailurestappendtNoneR	R
(R((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytruns
R(t__name__t
__module__RRRtsynchronized(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRs		tThreadPoolTestCasecBsÎeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
ejd	d
de
ƒge
_d„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(s
    Test threadpools.
    cCsHxAtdƒD]&}|jtƒr&Pntjdƒq
W|jdƒdS(Ni@Bgñh㈵øä>s%A long time passed without succeeding(txrangeRRRRtfail(RR
ti((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt_waitForLock>s
cCs<tjddƒ}|j|jdƒ|j|jdƒdS(sy
        L{ThreadPool.min} and L{ThreadPool.max} are set to the values passed to
        L{ThreadPool.__init__}.
        iiN(Rt
ThreadPooltassertEqualtmintmax(Rtpool((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_attributesGscCs§tjddƒ}|jƒ|j|jƒ|jt|jƒdƒtjddƒ}|jt|jƒdƒ|jƒ|j|jƒ|jt|jƒdƒdS(sV
        L{ThreadPool.start} creates the minimum number of threads specified.
        iiii
N(RR#tstartt
addCleanuptstopR$Rtthreads(RR'((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt
test_startQs

cCsþtjddƒ}|jƒ|j|jƒ|j|jgƒd„}dtfd„ƒY}|ƒ}tj	|ƒ}tj	|ƒ}|j
||ƒtjƒ}|j
|j
ƒ|j|jƒƒ~~tjƒ|j|ƒdƒ|j|ƒdƒdS(sü
        Test that creating threads in the threadpool with application-level
        objects as arguments doesn't results in those objects never being
        freed, with the thread maintaining a reference to them as long as it
        exists.
        iicSsdS(N((targ((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytworkerpstDumbcBseZRS((RR(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR0ssN(RR#R)R*R+R$R,tobjecttweakreftreftcallInThreadRtEventtsettwaitt
getTimeouttgctcollectR(RttpR/R0tuniquet	workerReft	uniqueReftevent((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_threadCreationArgumentsas$
		
cs†tjddƒ}|jƒˆj|jƒˆj|jgƒi‰tjƒ‰tjƒ‰g‰‡‡‡‡‡‡‡fd†}‡fd†}dt	fd„ƒY‰ˆƒ}t
j|ƒ}t
j|ƒ‰t
j|ƒ‰|j|||d|ƒ~~t
jƒˆjƒˆjˆjƒƒˆjˆƒdƒˆjˆƒdƒ~t
jƒˆj|ƒdƒˆjˆdƒdƒdS(	se
        As C{test_threadCreationArguments} above, but for
        callInThreadWithCallback.
        iicsQˆjˆjƒƒˆƒˆd<ˆƒˆd<ˆjƒˆjtj|ƒƒdS(NR=R>(R7R8R6RR2R3(tsuccesstresult(t	resultReftonResultDoneRR=tonResultWaitR>trefdict(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytonResult s



csˆƒS(N((R.ttest(R0(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR/¨sR0cBseZRS((RR(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR0¬sRHN(RR#R)R*R+R$R,RR5R1R2R3tcallInThreadWithCallbackR9R:R6R7R8R(RR;RGR/R<tonResultRef((RCRDR>R=RRER0RFs@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt4test_threadCreationArgumentsCallInThreadWithCallbackŠs6
!	


cCsztjddƒ}|j|jdƒ|j|jdƒtjtj|ƒƒ}|j|jdƒ|j|jdƒdS(s…
        Threadpools can be pickled and unpickled, which should preserve the
        number of threads and other parameters.
        iiN(RR#R$R%R&tpickletloadstdumps(RR'tcopy((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_persistenceÏscCs£d}tjƒ}|jƒ|j|jƒtjƒ}|jƒt||ƒ}x!t	|ƒD]}|||ƒq^W|j
|ƒ|j|jd|jfƒdS(s 
        Test synchronization of calls made with C{method}, which should be
        one of the mechanisms of the threadpool to execute work in threads.
        i
srun() re-entered %d timesN(
RR#R)R*R+RRRRRR"tfailIfR(RtmethodR	R;R
tactorR!((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt_threadpoolTestàs	


cCs|jd„ƒS(s;
        Call C{_threadpoolTest} with C{dispatch}.
        cSs|j||jƒS(N(tdispatchR(R;RS((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt<lambda>s(RT(R((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt
test_dispatchüstmessagesJdispatch\(\) is deprecated since Twisted 8.0, use callInThread\(\) insteadtcategorycCs|jd„ƒS(s?
        Call C{_threadpoolTest} with C{callInThread}.
        cSs|j|jƒS(N(R4R(R;RS((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRVs(RT(R((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_callInThread	scsdtfd„ƒY‰‡fd†}tjddƒ}|j|ƒ|jƒ|jƒ|jˆƒ}|jt|ƒdƒdS(si
        L{ThreadPool.callInThread} logs exceptions raised by the callable it
        is passed.
        tNewErrorcBseZRS((RR(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR[scs
ˆƒ‚dS(N(((R[(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt
raiseErrorsiiN(	t	ExceptionRR#R4R)R+tflushLoggedErrorsR$R(RR\R;terrors((R[s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_callInThreadExceptions


cs¥tjƒ‰ˆjƒg‰‡‡fd†}tjddƒ}|j|d„ƒ|jƒz|jˆƒWd|jƒX|j	ˆdƒ|j
ˆddƒdS(sÀ
        L{ThreadPool.callInThreadWithCallback} calls C{onResult} with a
        two-tuple of C{(True, result)} where C{result} is the value returned
        by the callable supplied.
        cs(ˆjƒˆj|ƒˆj|ƒdS(N(RR(RARB(twaitertresults(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRG0s

iicSsdS(NRH((((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRV6sNRH(RRRRR#RIR)R"R+t
assertTrueR$(RRGR;((RaRbs@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_callInThreadWithCallback%s

csídtfd„ƒY‰‡fd†}tjƒ‰ˆjƒg‰‡‡fd†}tjddƒ}|j||ƒ|jƒz|jˆƒWd|j	ƒX|j
ˆdƒ|jtˆdt
jƒƒ|jtˆdjˆƒƒdS(sÍ
        L{ThreadPool.callInThreadWithCallback} calls C{onResult} with a
        two-tuple of C{(False, failure)} where C{failure} represents the
        exception raised by the callable supplied.
        R[cBseZRS((RR(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR[Hscs
ˆƒ‚dS(N(((R[(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR\Kscs(ˆjƒˆj|ƒˆj|ƒdS(N(RR(RARB(RaRb(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRGSs

iiN(R]RRRRR#RIR)R"R+tassertFalseRct
isinstanceRtFailuret
issubclassttype(RR\RGR;((RaRbR[s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt0test_callInThreadWithCallbackExceptionInCallbackBs

csðdtfd„ƒY‰tjƒ}|jƒg‰‡‡fd†}tjddƒ}|j|d„ƒ|j|jƒ|j	ƒz|j
|ƒWd|jƒX|jˆƒ}|j
t|ƒdƒ|jˆdƒ|j
ˆddƒdS(sj
        L{ThreadPool.callInThreadWithCallback} logs the exception raised by
        C{onResult}.
        R[cBseZRS((RR(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR[kscs'ˆj|ƒˆj|ƒˆƒ‚dS(N(R(RARB(R[Rb(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRGss

iicSsdS(N(R(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRVysN(R]RRRRR#RIR4RR)R"R+R^R$RRcR(RRaRGR;R_((RbR[s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt0test_callInThreadWithCallbackExceptionInOnResultfs 

csÆg‰ddl‰tjƒ‰‡‡‡fd†}‡‡fd†}tjddƒ}|j||ƒ|jƒ|j|jƒˆj	|j
ƒƒ|jtˆƒdƒ|jˆdˆdƒdS(s
        L{ThreadPool.callInThreadWithCallback} calls the function it is
        given and the C{onResult} callback in the same thread.
        iÿÿÿÿNcs!ˆjˆjƒƒˆjƒdS(N(Rt	get_identR6(RARB(R?tthreadt	threadIds(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRG”scsˆjˆjƒƒdS(N(RRl((RmRn(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytfunc˜siii(
RmRR5RR#RIR)R*R+R7R8R$R(RRGRoR;((RmRnR?s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_callbackThread‰s
csätjjƒjd}d|d<g‰tjƒ‰‡‡fd†}‡fd†}tjddƒ}|j||ƒ|j	ƒ|j
|jƒˆj|j
ƒƒ|jtˆƒdƒ|j|ˆdƒ|j|ˆdƒd	S(
s±
        The context L{ThreadPool.callInThreadWithCallback} is invoked in is
        shared by the context the callable and C{onResult} callback are
        invoked in.
        iÿÿÿÿsthis must be presentttestingcs1tjjƒjd}ˆj|ƒˆjƒdS(Niÿÿÿÿ(RttheContextTrackertcurrentContexttcontextsRR6(RARBtctx(RtR?(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRG²s
cs'tjjƒjd}ˆj|ƒdS(Niÿÿÿÿ(RRrRsRtR(Ru(Rt(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRo·siiiN(RRrRsRtRR5RR#RIR)R*R+R7R8R$R(RtmyctxRGRoR;((RtR?s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_callbackContext¥s

cCsetjƒ}|jƒtjddƒ}|j|jƒ|jƒz|j|ƒWd|j	ƒXdS(sÃ
        Work added to the threadpool before its start should be executed once
        the threadpool is started: this is ensured by trying to release a lock
        previously acquired.
        iiN(
RRRRR#R4RR)R"R+(RRaR;((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_existingWorkÇs

csOtjƒ‰ˆjƒ|jˆjƒ‡fd†}|jtdt|ƒdS(sB
        Test for the deprecation of the dispatch method.
        csˆjdd„ƒS(NcSsdS(N(R(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRVãs(RUR((R;(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytcbâssFdispatch() is deprecated since Twisted 8.0, use callInThread() insteadN(RR#R)R*R+tassertWarnstDeprecationWarningt__file__(RRy((R;s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_dispatchDeprecationÚs
	csOtjƒ‰ˆjƒ|jˆjƒ‡fd†}|jtdt|ƒdS(sN
        Test for the deprecation of the dispatchWithCallback method.
        csˆjdd„d„d„ƒS(NcSsdS(N(R(tx((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRVöscSsdS(N(R(R~((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRV÷scSsdS(N(R(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRVøs(tdispatchWithCallbackR((R;(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRyós
smdispatchWithCallback() is deprecated since Twisted 8.0, use twisted.internet.threads.deferToThread() instead.N(RR#R)R*R+RzR{R|(RRy((R;s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt$test_dispatchWithCallbackDeprecationës
	(RRt__doc__R"R(R-R@RKRPRTRWRtsuppressR{RZR`RdRjRkRpRwRxR}R€(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR:s,			
		)	E								$	#		"		tRaceConditionTestCasecBs,eZd„Zd„Zd„Zd„ZRS(cCs5tjƒ|_tjddƒ|_|jjƒdS(Nii
(RR5R?RR#R)(R((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytsetUpscCs|`|jjƒ|`dS(N(R?RR+(R((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttearDowns
cCsÂ|jƒ}|jj|jjƒ|jj|ƒ|jjƒx*tdƒD]}|jj|jjƒqLW|jj|jjƒ|jj|ƒ|jjƒs¾|jjƒ|j	dƒndS(s…
        Test a race condition: ensure that actions run in the pool synchronize
        with actions run in the main thread.
        isActions not synchronizedN(
R8RR4R?R6R7tcleartrangetisSetR (RttimeoutR!((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_synchronizations

csmˆjˆjjdƒtƒ‰‡fd†‰‡‡‡fd†‰‡fd†}ˆj|ƒˆdƒˆS(s
        The submission of a new job to a thread pool in response to the
        C{onResult} callback does not cause a new thread to be added to the
        thread pool.

        This requires that the thread which calls C{onResult} to have first
        marked itself as available so that when the new job is queued, that
        thread may be considered to run it.  This is desirable so that when
        only N jobs are ever being executed in the thread pool at once only
        N threads will ever be created.
        icstjˆ|ƒdS(N(RtcallFromThread(RAtcounter(tsubmit(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRG1scs6ˆr%ˆjjˆ‡fd†ƒn
ˆjdƒdS(NcsˆdS(Ni(((RŒ(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRV7s(RRItcallbackR(RŒ(RGRtloopDeferred(RŒs@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR4s	csˆjˆjjdƒdS(Ni(R$Rtworkers(tignored(R(s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pytcbLoop;si
(R$RRRtaddCallback(RR’((RRRGRs@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyttest_singleThread s
	

(RRR„R…RŠR”(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyRƒs			t!ThreadSafeListDeprecationTestCasecBseZdZd„ZRS(sT
    Test deprecation of threadpool.ThreadSafeList in twisted.python.threadpool
    cCsitjƒ|j|jgƒ}|jt|ƒdƒ|j|ddtƒ|j|dddƒdS(sC
        Test deprecation of L{threadpool.ThreadSafeList}.
        iiRYRXs§twisted.python.threadpool.ThreadSafeList was deprecated in Twisted 10.1.0: This was an internal implementation detail of support for Jython 2.1, which is now obsolete.N(RtThreadSafeListt
flushWarningsttest_threadSafeListR$RtassertIdenticalR{(Rt
warningsShown((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR˜Js
(RRRR˜(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyR•Es(RRLRR2R9Rt
twisted.trialRRttwisted.pythonRRRRttwisted.internetRttwisted.internet.deferRR1RtsynchronizetTestCaseRRƒR•(((s@/usr/lib/python2.7/dist-packages/twisted/test/test_threadpool.pyt<module>s<"#
ÿÈD

Youez - 2016 - github.com/yon3zu
LinuXploit