Your IP : 172.28.240.42


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

ó
ê=Nc@sdZddlZddlZddlZddlmZddlmZyddlm	Z	Wne
k
rwdZ	nXdejfd„ƒYZ
e	dkr©de
_nZye	jd	ƒZWn7ek
rõZejejkrï[d
e
_q‚nXejƒ[dS(s
Tests for epoll wrapper.
iÿÿÿÿN(tunittest(tuntilConcludes(t_epolltEPollcBsMeZdZd„Zd„Zd„Zd„Zd„Zd„Zd„Z	RS(s1
    Tests for the low-level epoll bindings.
    cCsBtjƒ|_|jjdƒ|jjdƒ|jg|_dS(sp
        Create a listening server port and a list with which to keep track
        of created sockets.
        s	127.0.0.1iiN(s	127.0.0.1i(tsockettserverSockettbindtlistentconnections(tself((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pytsetUpscCs"x|jD]}|jƒq
WdS(sB
        Close any sockets which were opened by the test.
        N(Rtclose(R	tskt((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyttearDown"scCs´tjƒ}|jtƒy$|jd|jjƒdfƒWn0tjk
ro}|j|jdt	j
ƒnXtjdƒ‚|jj
ƒ\}}|jj||fƒ||fS(sL
        Return the two sockets which make up a new TCP connection.
        s	127.0.0.1iis&Connect should have raised EINPROGRESS(RtsetblockingtFalsetconnectRtgetsocknameterrortassertEqualtargsterrnotEINPROGRESSRtFailTesttacceptRtextend(R	tclienttetservertaddr((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyt_connectedPair*s
$cCsLytjdƒ}Wn(tk
r=}tjt|ƒƒ‚nX|jƒdS(s7
        Test the creation of an epoll object.
        iN(RtepolltOSErrorRRtstrR(R	tpR((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyttest_create<s
cCs¤|jttjdddƒ|jttjdƒ|jttjdƒ|jttjdƒ|jttjdgƒ|jttjiƒ|jttjƒdS(su
        Test that attempting to create an epoll object with some random
        objects raises a TypeError.
        iiitfooN((tassertRaisest	TypeErrorRRtNone(R	((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyttest_badCreateHscCsƒ|jƒ\}}tjdƒ}zP|jtj|jƒtjtjBƒ|jtj|jƒtjtjBƒWd|jƒXdS(s:
        Test adding a socket to an epoll object.
        iN(	RRRt_controltCTL_ADDtfilenotINtOUTR(R	RRR"((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyttest_addVs&*cCs|jƒ\}}tjdƒ}|jtj|jƒtjtjBtjBƒ|jtj|jƒtjtjBtjBƒt	j	ƒ}t
|jddƒ}t	j	ƒ}|j||dkƒ|j
ƒ|jƒtjf|jƒtjfg}|j
ƒ|j||ƒt	j	ƒ}t
|jddƒ}t	j	ƒ}|j||dkƒ|j|ƒ|jdƒ|jdƒt	j	ƒ}t
|jddƒ}t	j	ƒ}|j||dkƒ|j
ƒ|jƒtjtjBf|jƒtjtjBfg}|j
ƒ|j||ƒd	S(
sa
        Test waiting on an epoll object which has had some sockets added to
        it.
        iiièg{®Gáz„?iÈgš™™™™™¹?sHello!sworld!!!N(RRRR)R*R+R,R-tETttimeRtwaittfailIftsortRt
failUnlesstsend(R	RRR"tnowteventstthentexpected((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyttest_controlAndWaitds>""






(
t__name__t
__module__t__doc__R
R
RR#R(R.R:(((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyRs						s_epoll module unavailableis#epoll support missing from platform(R=RRR0t
twisted.trialRttwisted.python.utilRttwisted.pythonRtImportErrorR'tTestCaseRtskipRRtIOErrortexctENOSYSR(((s;/usr/lib/python2.7/dist-packages/twisted/test/test_epoll.pyt<module>s&$