kWc@sddlZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZyddlZWnek reZnXdejdZejZdZejo*eddejZyddlZddlZWnek rheZeZnXejZdZdejfd YZd ejfd YZd fd YZ dee fdYZ!dee fdYZ"de!fdYZ#deje fdYZ$dejfdYZ%ej&edde#fdYZ'ej&edde"fdYZ(ej&edde!fdYZ)ej&e*edd ej&edd!e$fd"YZ+ej&edd#e!fd$YZ,ej&edd%e#fd&YZ-d'ejfd(YZ.d)e-fd*YZ/d+e-fd,YZ0d-e-fd.YZ1d/e2fd0YZ3d1e3e'fd2YZ4d3ejfd4YZ5ej&edd5ee fd6YZ6ej&edd7ee fd8YZ7d9ejfd:YZ8d;efd<YZ9d=efd>YZ:d?ejfd@YZ;ej&e j<dAkdBdCejfdDYZ=ej&eddEe#fdFYZ>dGZ?dHZ@dIZAdJZBej&eBdKdLejfdMYZCej&eBdKdNeje fdOYZDdPZEeFdQkreEndS(RiN(t test_supporticCs_y,tj|tj}|j||fWntjtjfk rLtSX|jtSdS(sZTry to bind a socket on the given host:port and return True if that has been possible.N(tsockett SOCK_STREAMtbindterrortgaierrortFalsetclosetTrue(thosttporttfamilytsock((s&/usr/lib/python2.7/test/test_socket.pyt try_addresss sMichael Gilfix was here s::1R t SocketTCPTestcBseZdZdZRS(cCsDtjtjtj|_tj|j|_|jjddS(Ni(RtAF_INETRtservRt bind_portR tlisten(tself((s&/usr/lib/python2.7/test/test_socket.pytsetUp4scCs|jjd|_dS(N(RRtNone(R((s&/usr/lib/python2.7/test/test_socket.pyttearDown9s (t__name__t __module__RR(((s&/usr/lib/python2.7/test/test_socket.pyR2s t SocketUDPTestcBseZdZdZRS(cCs4tjtjtj|_tj|j|_dS(N(RRt SOCK_DGRAMRRRR (R((s&/usr/lib/python2.7/test/test_socket.pyR?scCs|jjd|_dS(N(RRR(R((s&/usr/lib/python2.7/test/test_socket.pyRCs (RRRR(((s&/usr/lib/python2.7/test/test_socket.pyR=s tThreadableTestcBsMeZdZdZdZdZdZdZdZdZ RS(sThreadable Test class The ThreadableTest class makes it easy to create a threaded client/server pair from an existing unit test. To create a new threaded class from an existing unit test, use multiple inheritance: class NewClass (OldClass, ThreadableTest): pass This class defines two new fixture functions with obvious purposes for overriding: clientSetUp () clientTearDown () Any new test functions within the class must then define tests in pairs, where the test name is preceeded with a '_' to indicate the client portion of the test. Ex: def testFoo(self): # Server portion def _testFoo(self): # Client portion Any exceptions raised by the clients during their tests are caught and transferred to the main thread to alert the testing framework. Note, the server setup function cannot call any blocking functions that rely on the client thread during setup, unless serverExplicitReady() is called just before the blocking call (such as in setting up a client/server connection and performing the accept() in setUp(). cCs4|j|_|j|_|j|_|j|_dS(N(Rt_ThreadableTest__setUpRt_ThreadableTest__tearDownt_setUpt _tearDown(R((s&/usr/lib/python2.7/test/test_socket.pyt__init__ms   cCs|jjdS(sThis method allows the server to explicitly indicate that it wants the client thread to proceed. This is useful if the server is about to execute a blocking routine that is dependent upon the client thread during its setup routine.N(t server_readytset(R((s&/usr/lib/python2.7/test/test_socket.pytserverExplicitReadytscCstj|_tj|_tj|_tjd|_|j}|jd}||d}t |d|}t j |j |f|_ |j|jjs|jjn|jjdS(Nit.t_(t threadingtEventR!t client_readytdonetQueuetqueuetidtrfindtgetattrtthreadtstart_new_threadt clientRunt client_threadRtis_setR"twait(Rt methodnametit test_method((s&/usr/lib/python2.7/test/test_socket.pyR{s  cCsI|j|jj|jjsE|jj}|j|ndS(N(RR)R4R+temptytgettfail(Rtmsg((s&/usr/lib/python2.7/test/test_socket.pyRs   cCs~|jj|j|jjt|s?tdny |Wn#tk ro}|jj |nX|j dS(Ns&test_func must be a callable function.( R!R4t clientSetUpR(R"tcallablet TypeErrort ExceptionR+tputtclientTearDown(Rt test_functstrerror((s&/usr/lib/python2.7/test/test_socket.pyR1s     cCstddS(Ns clientSetUp must be implemented.(tNotImplementedError(R((s&/usr/lib/python2.7/test/test_socket.pyR<scCs|jjtjdS(N(R)R"R/texit(R((s&/usr/lib/python2.7/test/test_socket.pyRAs ( RRt__doc__R R#RRR1R<RA(((s&/usr/lib/python2.7/test/test_socket.pyRGs$     tThreadedTCPSocketTestcBs&eZddZdZdZRS(trunTestcCs$tj|d|tj|dS(Nt methodName(RR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCstjtjtj|_dS(N(RRRtcli(R((s&/usr/lib/python2.7/test/test_socket.pyR<scCs'|jjd|_tj|dS(N(RJRRRRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  (RRR R<RA(((s&/usr/lib/python2.7/test/test_socket.pyRGs  tThreadedUDPSocketTestcBs&eZddZdZdZRS(RHcCs$tj|d|tj|dS(NRI(RR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCstjtjtj|_dS(N(RRRRJ(R((s&/usr/lib/python2.7/test/test_socket.pyR<scCs'|jjd|_tj|dS(N(RJRRRRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  (RRR R<RA(((s&/usr/lib/python2.7/test/test_socket.pyRKs  tSocketConnectedTestcBs8eZddZdZdZdZdZRS(RHcCstj|d|dS(NRI(RGR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCs9tj||j|jj\}}||_dS(N(RGRR#Rtaccepttcli_conn(Rtconntaddr((s&/usr/lib/python2.7/test/test_socket.pyRs  cCs'|jjd|_tj|dS(N(RNRRRGR(R((s&/usr/lib/python2.7/test/test_socket.pyRs  cCs6tj||jjt|jf|j|_dS(N(RGR<RJtconnecttHOSTR t serv_conn(R((s&/usr/lib/python2.7/test/test_socket.pyR<s cCs'|jjd|_tj|dS(N(RSRRRGRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  (RRR RRR<RA(((s&/usr/lib/python2.7/test/test_socket.pyRLs     tSocketPairTestcBs8eZddZdZdZdZdZRS(RHcCs'tjj|d|tj|dS(NRI(tunittesttTestCaseR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCstj\|_|_dS(N(Rt socketpairRRJ(R((s&/usr/lib/python2.7/test/test_socket.pyRscCs|jjd|_dS(N(RRR(R((s&/usr/lib/python2.7/test/test_socket.pyRs cCsdS(N((R((s&/usr/lib/python2.7/test/test_socket.pyR<scCs'|jjd|_tj|dS(N(RJRRRRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  (RRR RRR<RA(((s&/usr/lib/python2.7/test/test_socket.pyRTs     tGeneralModuleTestscBs$eZejed.k ddZdZdZdZ dZ dZ dZ eje edd d Zd Zd Zd ZdZdZeje edddZeje edddZeje edddZeje edddZeje edddZddZdZdZdZd Zd!Z d"Z!eje"j#d#kd$d%Z$d&Z%d'Z&d(Z'd)Z(d*Z)e*j+d+Z,eje-d,d-Z.RS(/sneed _socket modulecCstjtjtj}z?d|j|j|j|jf}|jt ||Wd|j Xd|j|j|jf}|jt ||dS(Ns7s7( t_socketRRRtfilenoR ttypetprotot assertEqualtreprR(Rtstexpected((s&/usr/lib/python2.7/test/test_socket.pyttest_csocket_reprs" cCstjtjtj}tj|}|j|j|j|jd}y|jWnt k rtnX|j ddS(NsSocket proxy still exists( RRRtweakreftproxyR]RZRRtReferenceErrorR:(RR_tp((s&/usr/lib/python2.7/test/test_socket.pyt test_weakref s  cCsRtjj}tj|}|j||~tj|j|dS(N(Rt_sockRbtreftassertIsRt gc_collectt assertIsNone(RR_tw((s&/usr/lib/python2.7/test/test_socket.pyttest_weakref__socks  cCsad}d}d}|jtj|d|jtj|d|jtj|ddS(Nc_s tjdS(N(RR(targstkwargs((s&/usr/lib/python2.7/test/test_socket.pyt raise_error sc_s tjdS(N(Rtherror(RnRo((s&/usr/lib/python2.7/test/test_socket.pyt raise_herror"sc_s tjdS(N(RR(RnRo((s&/usr/lib/python2.7/test/test_socket.pytraise_gaierror$ssError raising socket exception.(t assertRaisesRR(RRpRrRs((s&/usr/lib/python2.7/test/test_socket.pyttestSocketErrors   cCstjtjtj}|j|j|jd |j}|jt|j d|WdQX|jt }|j d|WdQX|j dt |j |jt }|j ddWdQX|j dt |j |jt|j dd|WdQX|jt }|j dd|WdQX|j dt |j |jt }|j dddWdQX|j dt |j |jt }|j dd|WdQX|j d t |j |jt }|j dddWdQX|j d t |j |jt }|j dWdQX|j d t |j |jt }|j dd|d WdQX|j d t |j dS(Ntiu☠y@s not complextfoos not NoneTypetbarsan integer is requireds (1 given)is (4 given)(Rvi(RRRt addCleanupRRt getsocknameRttUnicodeEncodeErrortsendtoR>tassertIntstrt exceptionR(RR_tsocknametcm((s&/usr/lib/python2.7/test/test_socket.pyttestSendtoErrors-s@  cCs<tjtjtjtjtjtjtjtjdS(N( RRRRtSOCK_RAWtSOCK_RDMtSOCK_SEQPACKETt SOL_SOCKETt SO_REUSEADDR(R((s&/usr/lib/python2.7/test/test_socket.pyttestCrucialConstantsTscCstj}ytj|}Wn!tjk rB|jdnX|j|jddkdytj|\}}}Wn!tjk r|jdnX||g|}tj|}||kr|j d|t |fndS(Nsname lookup failureR$isError resolving host to ip.saddress lookup failures=Error testing host resolution mechanisms. (fqdn: %s, all: %s)( Rt gethostnamet gethostbynameRtskipTestt assertTruetfindt gethostbyaddrtgetfqdnR:R^(Rthostnametipthnametaliasestipaddrstall_host_namestfqhn((s&/usr/lib/python2.7/test/test_socket.pyttestHostnameRes_s  t getrefcountstest needs sys.getrefcount()cCsWy#tjt}tjtdWn-tk rR|jtjt|dnXdS(Nis$socket.getnameinfo loses a reference(tsysRRRt getnameinfoR>R](Rtorig((s&/usr/lib/python2.7/test/test_socket.pyttestRefCountGetNameInfors  cCs/ytjddWntjk r*nXdS(Ntxi(Riii(RRR(R((s&/usr/lib/python2.7/test/test_socket.pyttestInterpreterCrash~scCsidtj6dtj6dtj6dtj6}x|jD]\}}d|>d}xKdddd ddd fD].}|j||@||||@|@qqW||}|j||@||jt|d q;WdS( Ni iliiiiigE#i2Tvi"il( RthtonltntohlthtonstntohstitemsR]Rtt OverflowError(RtsizestfunctsizetmaskR6tswapped((s&/usr/lib/python2.7/test/test_socket.pyttestNtoHs", cCsddddddg}ddd d d d g}xB|D]:}tj|tj|tj|tj|q7Wxf|D]^}|jttj||jttj||jttj||jttj|q|WdS( Niiillliiilll(RRRRRRtR(Rt good_valuest bad_valuestk((s&/usr/lib/python2.7/test/test_socket.pyttestNtoHErrorss     cCs|j}tjjdsNtjjdsNtjjdsNtjdkrWd }nd}xE|D]4}ytj|d }PWqdtjk rqdXqdWtjtj|}|||ytj|d }Wntjk rd}nX||||tj|||tj|d ||dk rX|tj|d |n|j t tjd |j t tjd dS(Ntlinuxtfreebsdtnetbsdtdarwintdaytimetqotdtdomaintechottcptudpii(RRR(RRR( R]Rtplatformt startswithRt getservbynameRRt getservbyportRtR(RteqtservicestserviceR tport2tudpport((s&/usr/lib/python2.7/test/test_socket.pyt testGetServBys6        cCs|jtjdtj}|j|jd|jtjd|jtjdtj}|j|jd|jtjd|jtjdtj}|j|jd|j|jttjd|jt tjddS(Ni itspam( R]RtgetdefaulttimeoutRt gettimeoutRtsetdefaulttimeoutRtt ValueErrorR>(RR_((s&/usr/lib/python2.7/test/test_socket.pyttestDefaultTimeouts         t inet_atonstest needs socket.inet_aton()cCs6|jdtjd|jdtjddS(Ntis0.0.0.0ss255.255.255.255ts(R]RR(R((s&/usr/lib/python2.7/test/test_socket.pyttestIPv4_inet_aton_fourbytesst inet_ptonstest needs socket.inet_pton()csddlm}mmfd}|jd|d|jd|d|jd|d |jd |d |jd |d |jd|d|jd|d|jd|d |jd |d dS(Ni(RRRcs |S(N((ta(RR(s&/usr/lib/python2.7/test/test_socket.pytsRs0.0.0.0ss 255.0.255.0ss170.170.170.170ss1.2.3.4ss255.255.255.255(RRRRR](Rtftg((RRs&/usr/lib/python2.7/test/test_socket.pyttestIPv4toStringscsy6ddlmmm}|s5|jdnWntk rV|jdnXfd}|jd|d|jd|d |jd d|d |jd |ddS(Ni(RtAF_INET6thas_ipv6sIPv6 not availables+could not import needed symbols from socketcs |S(N((R(RR(s&/usr/lib/python2.7/test/test_socket.pyR sRis::s0::0tis1::sEvV $s$45ef:76cb:1a:56ef:afeb:bac:1924:aeaetRt(RRRRRt ImportErrorR](RRR((RRs&/usr/lib/python2.7/test/test_socket.pyttestIPv6toStrings t inet_ntopstest needs socket.inet_ntop()csddlm}mmfd}|jd|d|jd|d|jd|d |jd |d |jd|d|jd|d|jd|d dS( Ni(t inet_ntoaRRcs |S(N((R(RR(s&/usr/lib/python2.7/test/test_socket.pyRss1.0.1.0ss 170.85.170.85sUUs255.255.255.255ss1.2.3.4s(RRRRR](RRR((RRs&/usr/lib/python2.7/test/test_socket.pyttestStringToIPv4scsy6ddlmmm}|s5|jdnWntk rV|jdnXfd}|jd|d|jd |d|jd |d dS(Ni(RRRsIPv6 not availables+could not import needed symbols from socketcs |S(N((R(RR(s&/usr/lib/python2.7/test/test_socket.pyR+ss::Ris::1iss!aef:b01:506:1001:ffff:9997:55:170s UpRtt(RRRRRRR](RRR((RRs&/usr/lib/python2.7/test/test_socket.pyttestStringToIPv6"s s0.0.0.0cCs?tj}|j|df|j\}}|j|S(sUse a temporary socket to elicit an unused ephemeral port. Args: bind_address: Hostname or IP address to search for a port on. Returns: A most likely to be unused port. i(RRRzR(Rt bind_addressttempsockR R ((s&/usr/lib/python2.7/test/test_socket.pyt_get_unused_port6s   cCs|j}tjtjtj}|j|j|jd|f|j}ytjtj }Wn!tj k r|j dnX|j |dd|fd|d|j |d|dS(Ns0.0.0.0sname lookup failureis %s invalidi(RRRRRyRRRzRRRRR}R](RR R tnamet my_ip_addr((s&/usr/lib/python2.7/test/test_socket.pyt testSockNameDs  %cCsZtjtjtj}|j|j|jtjtj}|j|dkddS(Nisinitial mode is reuse( RRRRyRt getsockoptRRt assertFalse(RR treuse((s&/usr/lib/python2.7/test/test_socket.pyttestGetSockOptVscCsstjtjtj}|j|j|jtjtjd|jtjtj}|j |dkddS(Niisfailed to set reuse mode( RRRRyRt setsockoptRRRR(RR R((s&/usr/lib/python2.7/test/test_socket.pyttestSetSockOpt^s cCsLtjtjtj}|jd|j|jtj|jddS(NiR(RRRt settimeoutRRtRtsend(RR ((s&/usr/lib/python2.7/test/test_socket.pyttestSendAfterClosefs  cCsetjtjtj}|j|jtj|j|jtj|j|jd|jdS(Ni(RRRR]R R[R\R(RR ((s&/usr/lib/python2.7/test/test_socket.pyttestNewAttributesms cCstj}|j|jtj}|d}|d}|jt|jt|f|jt|jt|fxrt j D]d}tj}y|jt|fWn7t k r}|j t j ks|dkrqqXPqWdS(Nii(RRyRRtfind_unused_portRtRRRRt itertoolstcounttOSErrorterrnot EADDRINUSE(RR R tbig_porttneg_portR6te((s&/usr/lib/python2.7/test/test_socket.pyttest_getsockaddrargus      tntsWindows specificcCs|jttjd|jttd|jttd|jttd|jttdtj}|j|j|jt|jdd|jtj d dS( Ntioctlt SIO_RCVALLt RCVALL_ONt RCVALL_OFFtSIO_KEEPALIVE_VALSiiid(iidid( RthasattrRRyRRtRRRR(RR_((s&/usr/lib/python2.7/test/test_socket.pyttest_sock_ioctls cCsWytjddWn;tjk rQ}|jtjkrK|jdnnXx0tjtdD]}|jt |dqeWtjddtjddtjddt rtjddntjtdtjtdtjtdtjtdtjtdtj }x0|D](\}}}}}|j|tj q-Wtjtdd tj }x0|D](\}}}}}|j|tj q{Wtjtdd d tj tjtdd d d tjtjdd tjtj d tjttd rSy#tjddd d d tjWqStjk rOqSXndS( Nt localhostiPsbuggy libc versionis 127.0.0.1s::1thttplPitAI_NUMERICSERV(Rt getaddrinfoRRt EAI_SERVICERRRRR]tlent SUPPORTS_IPV6RRtSOL_TCPt AI_PASSIVEt AF_UNSPECRR(RterrtinfotinfosR R%tsocktype((s&/usr/lib/python2.7/test/test_socket.pyttestGetaddrinfosB cs>ttd s ttd r0jdnfd}fd}tj\}}tjtj|}z|r|jdnjt&tj d|j dt j WdQX|rtjtj|tj djtj |j dt j nWdtjtj||j|jXdS( NtalarmRWs9signal.alarm and socket.socketpair required for this testcsjttjddS(Ni(RtRtmathtacosh(Rn(R(s&/usr/lib/python2.7/test/test_socket.pyt ok_handlerscs"jttjddddS(Nii(RtRRR(Rn(R(s&/usr/lib/python2.7/test/test_socket.pytraising_handlersg?iR(RtsignalRRRWtSIGALRMRRttZeroDivisionErrorRtsendallRt SOCK_MAX_SIZEttimeoutR(Rt with_timeoutRRtcR_t old_alarm((Rs&/usr/lib/python2.7/test/test_socket.pytcheck_sendall_interrupteds(    cCs|jtdS(N(RR(R((s&/usr/lib/python2.7/test/test_socket.pyttest_sendall_interruptedscCs|jtdS(N(RR(R((s&/usr/lib/python2.7/test/test_socket.pyt%test_sendall_interrupted_with_timeoutscCsWxPdD]H}tjtjtj}|jtdf|j||jqWdS(Nii(ii(RRRRRRRR(Rtbacklogtsrv((s&/usr/lib/python2.7/test/test_socket.pyttest_listen_backlogs   cCsbddl}tjtjtj}|jtdf|jt|j|j d|j dS(Niii( t _testcapiRRRRRRRtRRtINT_MAXR(RR%R#((s&/usr/lib/python2.7/test/test_socket.pyttest_listen_backlog_overflows  sIPv6 required for this test.cCs]|jttjddtjtjtj}z|jt|jdWd|jXdS(Ns::1ili(s::1il(s::1ii(RtRRRRRRR(RR_((s&/usr/lib/python2.7/test/test_socket.pyt test_flowinfos  N(/RRRUt skipUnlessRYRRaRfRmRuRRRRRRRRRRRRRRRRRRRRRRRRtosRRRRR R!R$Rt cpython_onlyR'RR((((s&/usr/lib/python2.7/test/test_socket.pyRXsN!   '     )        $ 1     s!Threading required for this test.t BasicTCPTestcBseZddZdZdZdZdZdZdZdZ d Z d Z d Z e jeed d dZdZdZdZdZdZejeZejdZRS(RHcCstj|d|dS(NRI(RLR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCs&|jjd}|j|tdS(Ni(RNtrecvR]tMSG(RR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecv scCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt _testRecvscCsL|jjttd}|jjd}||}|j|tdS(Nii(RNR-RR.R](Rtseg1tseg2R;((s&/usr/lib/python2.7/test/test_socket.pyttestOverFlowRecvs cCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt_testOverFlowRecvscCs,|jjd\}}|j|tdS(Ni(RNtrecvfromR]R.(RR;RP((s&/usr/lib/python2.7/test/test_socket.pyt testRecvFromscCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt _testRecvFrom"scCsX|jjttd\}}|jjd\}}||}|j|tdS(Nii(RNR5RR.R](RR1RPR2R;((s&/usr/lib/python2.7/test/test_socket.pyttestOverFlowRecvFrom%s" cCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt_testOverFlowRecvFrom,scCsJd}x)|jjd}|s%Pn||7}q |j|dddS(NRviRi(RNR-R](RR;tread((s&/usr/lib/python2.7/test/test_socket.pyt testSendAll/s cCsdd}|jj|dS(NRi(RSR(Rt big_chunk((s&/usr/lib/python2.7/test/test_socket.pyt _testSendAll9s tfromfdssocket.fromfd not availblecCs]|jj}tj|tjtj}|j|j|jd}|j |t dS(Ni( RNRZRR>RRRyRR-R]R.(RtfdR R;((s&/usr/lib/python2.7/test/test_socket.pyt testFromFd=s cCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt _testFromFdGscCsB|jj}|j|j|jd}|j|tdS(Ni(RNtdupRyRR-R]R.(RR R;((s&/usr/lib/python2.7/test/test_socket.pyttestDupJscCs|jjtdS(N(RSRR.(R((s&/usr/lib/python2.7/test/test_socket.pyt_testDupQscCs3|jjd}|j|t|jjdS(Ni(RNR-R]R.R)R4(RR;((s&/usr/lib/python2.7/test/test_socket.pyt testShutdownTscCs$|jjt|jjddS(Ni(RSRR.tshutdown(R((s&/usr/lib/python2.7/test/test_socket.pyt _testShutdown]scCstddl}|jjt|jt|jj|jd|jt|jjd|jd|jjddS(Niii( R%RSRR.RtRRFR&tUINT_MAX(RR%((s&/usr/lib/python2.7/test/test_socket.pyt_testShutdown_overflowcs (RRR R/R0R3R4R6R7R8R9R;R=RUR)RRR@RARCRDRERGRR+ttestShutdown_overflowRI(((s&/usr/lib/python2.7/test/test_socket.pyR,s(              t BasicUDPTestcBsJeZddZdZdZdZdZdZdZRS(RHcCstj|d|dS(NRI(RKR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR qscCs,|jjtt}|j|tdS(N(RR-RR.R](RR;((s&/usr/lib/python2.7/test/test_socket.pyttestSendtoAndRecvtscCs#|jjtdt|jfdS(Ni(RJR|R.RRR (R((s&/usr/lib/python2.7/test/test_socket.pyt_testSendtoAndRecvyscCs2|jjtt\}}|j|tdS(N(RR5RR.R](RR;RP((s&/usr/lib/python2.7/test/test_socket.pyR6|scCs#|jjtdt|jfdS(Ni(RJR|R.RRR (R((s&/usr/lib/python2.7/test/test_socket.pyR7scCs|jt|jjddS(Ni(RtRRR5(R((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromNegativescCs#|jjtdt|jfdS(Ni(RJR|R.RRR (R((s&/usr/lib/python2.7/test/test_socket.pyt_testRecvFromNegatives( RRR RLRMR6R7RNRO(((s&/usr/lib/python2.7/test/test_socket.pyRKns      t TCPCloserTestcBseZdZdZRS(cCs||jj\}}|j|j}tj|gggd\}}}|j||g|j|jdddS(Ng?iRv(RRMRRJtselectR]R-(RRORPtsdR:twriteR ((s&/usr/lib/python2.7/test/test_socket.pyt testCloses   $cCs*|jjt|jftjddS(Ng?(RJRQRRR ttimetsleep(R((s&/usr/lib/python2.7/test/test_socket.pyt _testCloses(RRRTRW(((s&/usr/lib/python2.7/test/test_socket.pyRPs RWstest needs socket.socketpair()tBasicSocketPairTestcBs8eZddZdZdZdZdZRS(RHcCstj|d|dS(NRI(RTR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCs&|jjd}|j|tdS(Ni(RR-R]R.(RR;((s&/usr/lib/python2.7/test/test_socket.pyR/scCs|jjtdS(N(RJRR.(R((s&/usr/lib/python2.7/test/test_socket.pyR0scCs|jjtdS(N(RRR.(R((s&/usr/lib/python2.7/test/test_socket.pyttestSendscCs&|jjd}|j|tdS(Ni(RJR-R]R.(RR;((s&/usr/lib/python2.7/test/test_socket.pyt _testSends(RRR R/R0RYRZ(((s&/usr/lib/python2.7/test/test_socket.pyRXs     tNonBlockingTCPTestscBs}eZddZdZdZejdZejeZdZ dZ dZ dZ d Z d ZRS( RHcCstj|d|dS(NRI(RGR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCs|jjt|j|jj|jjt|j|jjdtj}y|jjWnt j k rnXtj}|j ||dkddS(Ngg?s Error setting non-blocking mode.( Rt setblockingRRkRRR]RURMRRR(Rtstarttend((s&/usr/lib/python2.7/test/test_socket.pyttestSetBlockings  cCsdS(N((R((s&/usr/lib/python2.7/test/test_socket.pyt_testSetBlockingscCsddl}|j|jkr.|jdn|jjt|j|jjd|jj|jd|j |jjdS(Nisneeds UINT_MAX < ULONG_MAXgi( R%RHt ULONG_MAXRRR\RR]RRk(RR%((s&/usr/lib/python2.7/test/test_socket.pyttestSetBlocking_overflows cCs|jjdy|jj\}}Wntjk r?nX|jdtj|jggg\}}}|j|kr|jj\}}|jn |jddS(Nis'Error trying to do non-blocking accept.s'Error trying to do accept after select.(RR\RMRRR:RQR(RRORPR:RSR ((s&/usr/lib/python2.7/test/test_socket.pyt testAccepts $ cCs*tjd|jjt|jfdS(Ng?(RURVRJRQRRR (R((s&/usr/lib/python2.7/test/test_socket.pyt _testAccepts cCs#|jj\}}|jdS(N(RRMR(RRORP((s&/usr/lib/python2.7/test/test_socket.pyt testConnectscCs-|jjd|jjt|jfdS(Ni (RJRRQRRR (R((s&/usr/lib/python2.7/test/test_socket.pyt _testConnectscCs|jj\}}|jdy|jtt}Wntjk rQnX|jdt j |ggg\}}}||kr|jtt}|j |j |tn |jddS(Nis%Error trying to do non-blocking recv.s0Error during select call to non-blocking socket.( RRMR\R-RR.RRR:RQRR](RRORPR;R:RSR ((s&/usr/lib/python2.7/test/test_socket.pyR/s  !  cCs:|jjt|jftjd|jjtdS(Ng?(RJRQRRR RURVRR.(R((s&/usr/lib/python2.7/test/test_socket.pyR0s (RRR R_R`RR+Rbt_testSetBlocking_overflowRcRdReRfR/R0(((s&/usr/lib/python2.7/test/test_socket.pyR[s         tFileObjectClassTestCasecBseZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZdZdZdZRS(iRHcCstj|d|dS(NRI(RLR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCs,tj||jjd|j|_dS(Ntrb(RLRRNtmakefiletbufsizet serv_file(R((s&/usr/lib/python2.7/test/test_socket.pyRs cCs:|jj|j|jjtj|d|_dS(N(RlRRtclosedRLRR(R((s&/usr/lib/python2.7/test/test_socket.pyRs  cCs&tj||jjd|_dS(Ntwb(RLR<RSRjtcli_file(R((s&/usr/lib/python2.7/test/test_socket.pyR<s cCs:|jj|j|jjd|_tj|dS(N(RoRRRmRRLRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  cCsL|jjttd}|jjd}||}|j|tdS(Ni(RlR:RR.R](Rt first_segt second_segR;((s&/usr/lib/python2.7/test/test_socket.pyt testSmallRead%s cCs!|jjt|jjdS(N(RoRSR.tflush(R((s&/usr/lib/python2.7/test/test_socket.pyt_testSmallRead,scCs#|jj}|j|tdS(N(RlR:R]R.(RR;((s&/usr/lib/python2.7/test/test_socket.pyt testFullRead0scCs!|jjt|jjdS(N(RoRSR.R(R((s&/usr/lib/python2.7/test/test_socket.pyt _testFullRead5scCsFd}x)|jjd}|s%Pn||7}q |j|tdS(NRvi(RlR:R]R.(Rtbuftchar((s&/usr/lib/python2.7/test/test_socket.pyttestUnbufferedRead9s cCs!|jjt|jjdS(N(RoRSR.Rs(R((s&/usr/lib/python2.7/test/test_socket.pyt_testUnbufferedReadCscCs#|jj}|j|tdS(N(RltreadlineR]R.(Rtline((s&/usr/lib/python2.7/test/test_socket.pyt testReadlineGscCs!|jjt|jjdS(N(RoRSR.Rs(R((s&/usr/lib/python2.7/test/test_socket.pyt _testReadlineLscCs|jjtd}|jd||jjtd}|jd||jj}|jd||jj}|jd||jj}|jt|dS(Ns A baloo iss a bears sA BALOO IS A BEAR. (RlR:RR]R{R.(Rt a_baloo_ist_a_bearR|((s&/usr/lib/python2.7/test/test_socket.pyttestReadlineAfterReadPscCsA|jjd|jjd|jjt|jjdS(NsA baloo is a bear sA BALOO IS A BEAR. (RoRSR.Rs(R((s&/usr/lib/python2.7/test/test_socket.pyt_testReadlineAfterRead\scCsK|jjtd}|jd||jj}|jd|dS(NsEnd Of tLine(RlR:RR]R{(Rtend_of_R|((s&/usr/lib/python2.7/test/test_socket.pyttestReadlineAfterReadNoNewlinebscCs|jjddS(Ns End Of Line(RoRS(R((s&/usr/lib/python2.7/test/test_socket.pyt_testReadlineAfterReadNoNewlinehscCs|j|jj dS(N(RRlRm(R((s&/usr/lib/python2.7/test/test_socket.pyttestClosedAttrkscCs|j|jj dS(N(RRoRm(R((s&/usr/lib/python2.7/test/test_socket.pyt_testClosedAttrns(RRRkR RRR<RARrRtRuRvRyRzR}R~RRRRRR(((s&/usr/lib/python2.7/test/test_socket.pyRh s(                tFileObjectInterruptedTestCasecBsreZdZdefdYZedZddZddZdZ dZ dd Z d Z RS( s=Test that the file object correctly handles EINTR internally.t MockSocketcBseZddZdZRS(cCst||_dS(N(titert _recv_step(Rt recv_funcs((s&/usr/lib/python2.7/test/test_socket.pyR vscCs|jjS(N(Rtnext(RR((s&/usr/lib/python2.7/test/test_socket.pyR-{s((RRR R-(((s&/usr/lib/python2.7/test/test_socket.pyRus cCstjtjdS(N(RRRtEINTR(((s&/usr/lib/python2.7/test/test_socket.pyt _raise_eintr~sicKsr|jdd|jddg}tj||}|j|j|d|j|j|ddS(NRcSsdS(Ns"This is the first line And the sec((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(Nsond line is here ((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(NRv((((s&/usr/lib/python2.7/test/test_socket.pyRssThis is the first line sAnd the second line is here (RRRt _fileobjectR]R{(RRRot mock_socktfo((s&/usr/lib/python2.7/test/test_socket.pyt_test_readlines cKsY|jdd|jddg}tj||}|j|j|ddS(NRcSsdS(Ns"This is the first line And the sec((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(Nsond line is here ((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(NRv((((s&/usr/lib/python2.7/test/test_socket.pyRss3This is the first line And the second line is here (RRRRR]R:(RRRoRR((s&/usr/lib/python2.7/test/test_socket.pyt _test_reads cCs8|j|jdd|j|jdddS(NRid(RR(R((s&/usr/lib/python2.7/test/test_socket.pyt test_defaults  cCsP|jdd|jdddd|jdd|jdddddS(NRkiRid(RR(R((s&/usr/lib/python2.7/test/test_socket.pyttest_with_1k_bufferscCs|jdddd|jddg}tj|dd}|j|j|d |j|j|d dS( NRcSsdS(Ntaa((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(Ns ((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(NtBB((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(Ntbb((((s&/usr/lib/python2.7/test/test_socket.pyRscSsdS(NRv((((s&/usr/lib/python2.7/test/test_socket.pyRsRkisaa tBBbb(RRRRR]R{(RRRR((s&/usr/lib/python2.7/test/test_socket.pyt_test_readline_no_buffers cCsD|j|jdd|jdd|jdddddS(NRiRkiid(RR(R((s&/usr/lib/python2.7/test/test_socket.pyttest_no_buffers ( RRRFtobjectRt staticmethodRRRRRRR(((s&/usr/lib/python2.7/test/test_socket.pyRrs    t!UnbufferedFileObjectClassTestCasecBs&eZdZdZdZdZRS(sRepeat the tests from FileObjectClassTestCase with bufsize==0. In this case (and in this case only), it should be possible to create a file object, read a line from it, create another file object, read another line from it, without loss of data in the first file object's buffer. Note that httplib relies on this when reading multiple requests from the same socket.icCsb|jj}|j|dt|jjdd|_|jj}|j|dtdS(NsA. RiisB. (RlR{R]R.RNRj(RR|((s&/usr/lib/python2.7/test/test_socket.pyttestUnbufferedReadlines cCs9|jjdt|jjdt|jjdS(NsA. sB. (RoRSR.Rs(R((s&/usr/lib/python2.7/test/test_socket.pyt_testUnbufferedReadlines(RRRFRkRR(((s&/usr/lib/python2.7/test/test_socket.pyRs t#LineBufferedFileObjectClassTestCasecBs?eZdZdefdYZdZdZdZRS(it SocketMemocBsAeZdZdZddZddZdZdZRS(sGA wrapper to keep track of sent data, needed to examine write behaviourcCs||_g|_dS(N(Rgtsent(RR ((s&/usr/lib/python2.7/test/test_socket.pyR s icCs-|jj||}|jj|| |S(N(RgRRtappend(Rtdatatflagstn((s&/usr/lib/python2.7/test/test_socket.pyRscCs'|jj|||jj|dS(N(RgRRR(RRR((s&/usr/lib/python2.7/test/test_socket.pyRscCst|j|S(N(R.Rg(Rtattr((s&/usr/lib/python2.7/test/test_socket.pyt __getattr__scCs5g|jD]'}t|tr+|jn|^q S(N(Rt isinstancet memoryviewttobytes(RR((s&/usr/lib/python2.7/test/test_socket.pytgetsents(RRRFR RRRR(((s&/usr/lib/python2.7/test/test_socket.pyRs     cCs,tj||j|jj|j_dS(N(RhRRRlRg(R((s&/usr/lib/python2.7/test/test_socket.pyRs cCstj}|j|I|j|IJ|j|I|j|I|j|IJ|jdIJ|jjd||f}d|||f}d}|j|jjj|||gdS(NRvs%s %s s %s %s %s s (R.tstripRlRsR]RgR(RR;tmsg1tmsg2tmsg3((s&/usr/lib/python2.7/test/test_socket.pyttestLinebufferedWrites        cCstj}d||f}d|||f}d}|jj}|j|||jj}|j|||jj}|j||dS(Ns%s %s s %s %s %s s (R.RRoR{R](RR;RRRtl1tl2tl3((s&/usr/lib/python2.7/test/test_socket.pyt_testLinebufferedWrites (RRRkRRRRR(((s&/usr/lib/python2.7/test/test_socket.pyRs   t$SmallBufferedFileObjectClassTestCasecBseZdZRS(i(RRRk(((s&/usr/lib/python2.7/test/test_socket.pyRstNetworkConnectionTestcBseZdZdZRS(sProve network connection.cCs+tjt|jf|_|j|_dS(N(Rtcreate_connectionRRR RJRS(R((s&/usr/lib/python2.7/test/test_socket.pyR<s(RRRFR<(((s&/usr/lib/python2.7/test/test_socket.pyRst BasicTCPTest2cBseZdZRS(sLTests that NetworkConnection does not break existing TCP functionality. (RRRF(((s&/usr/lib/python2.7/test/test_socket.pyRstNetworkConnectionNoServercBsNeZdejfdYZejdZdZdZdZ RS(RcBseZdZRS(cGstjddS(Ns timed out(RR(RRn((s&/usr/lib/python2.7/test/test_socket.pyRQ#s(RRRQ(((s&/usr/lib/python2.7/test/test_socket.pyR"sccs/tj}|jt_z dVWd|t_XdS(s*Return a socket which times out on connectN(RR(Rt old_socket((s&/usr/lib/python2.7/test/test_socket.pytmocked_socket_module&s    cCstj}tjtjtj}|j|j|jtj}|j t |fWdQX|j |j j t jdS(N(RRRRRRyRRtRRQRRR]RRt ECONNREFUSED(RR RJR((s&/usr/lib/python2.7/test/test_socket.pyt test_connect0s  cCstj}|jtj}tjt|fWdQXtjg}t tdrh|j tj n|j |j j|dS(Nt ENETUNREACH(RRRtRRRRRRRRRRR}R(RR Rtexpected_errnos((s&/usr/lib/python2.7/test/test_socket.pyttest_create_connection8s  c CsC|j1|jtjtjtdfWdQXWdQXdS(Ni(RRtRRRRR(R((s&/usr/lib/python2.7/test/test_socket.pyttest_create_connection_timeoutSs ( RRRRt contextlibtcontextmanagerRRRR(((s&/usr/lib/python2.7/test/test_socket.pyR!s   tNetworkConnectionAttributesTestcBseZddZdZdZdZeZdZeZdZ eZ dZ eZ dZ eZd ZeZd ZRS( RHcCs$tj|d|tj|dS(NRI(RR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR ^scCstj|_dS(N(RRt source_port(R((s&/usr/lib/python2.7/test/test_socket.pyR<bscCs'|jjd|_tj|dS(N(RJRRRRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAes  cCs#|jj\}}|jdS(N(RRMR(RRORP((s&/usr/lib/python2.7/test/test_socket.pyt _justAcceptjscCsNtjt|jfdd|_|j|jj|j|jjddS(NRii( RRRRR RJRyRR]R (R((s&/usr/lib/python2.7/test/test_socket.pyt _testFamilyos!cCsgtjt|jfdddd|jf|_|j|jj|j|jj d|jdS(NRitsource_addressRvi( RRRRR RRJRyRR]Rz(R((s&/usr/lib/python2.7/test/test_socket.pyt_testSourceAddressuscCs|jtjdktjdz2tjt|jf|_|j |jj WdtjdX|j |jj ddS(Ni*( RRRRRRRRR RJRyRR]R(R((s&/usr/lib/python2.7/test/test_socket.pyt_testTimeoutDefault~s cCs|jtjdktjdz8tjt|jfdd|_|j |jj WdtjdX|j |jj ddS(NiR( RRRRRRRRR RJRyRR]R(R((s&/usr/lib/python2.7/test/test_socket.pyt_testTimeoutNones !cCs>tjt|jfdd|_|j|jjddS(NRi(RRRRR RJR]R(R((s&/usr/lib/python2.7/test/test_socket.pyt_testTimeoutValueNameds!cCsNtjt|jfd|_|j|jj|j|jjddS(Ni( RRRRR RJRyRR]R(R((s&/usr/lib/python2.7/test/test_socket.pyt_testTimeoutValueNonameds(RRR R<RARt testFamilyRttestSourceAddressRttestTimeoutDefaultRttestTimeoutNoneRttestTimeoutValueNamedRttestTimeoutValueNonamedR(((s&/usr/lib/python2.7/test/test_socket.pyR[s          tNetworkConnectionBehaviourTestcBsGeZddZdZdZdZeZdZdZRS(RHcCs$tj|d|tj|dS(NRI(RR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCsdS(N((R((s&/usr/lib/python2.7/test/test_socket.pyR<scCs'|jjd|_tj|dS(N(RJRRRRA(R((s&/usr/lib/python2.7/test/test_socket.pyRAs  cCsC|jj\}}|j|jtjd|jddS(Nisdone!(RRMRyRRURVR(RRORP((s&/usr/lib/python2.7/test/test_socket.pyttestInsideTimeouts cCsBtjt|jf|_}|jd}|j|ddS(Nisdone!(RRRRR RJR-R](RR R((s&/usr/lib/python2.7/test/test_socket.pyt_testInsideTimeoutscsEtjt|jfdd|_|jtjfddS(NRics jdS(Ni(R-((R (s&/usr/lib/python2.7/test/test_socket.pyRs(RRRRR RJRtR(R((R s&/usr/lib/python2.7/test/test_socket.pyt_testOutsideTimeouts%( RRR R<RARttestOutsideTimeoutRR(((s&/usr/lib/python2.7/test/test_socket.pyRs     tUrllib2FileobjectTestcBseZdZRS(cCsdddY}|}tj|}|j|j|j |}tj|dt}|j|j|jdS(NRcBs eZeZdZdZRS(cSsdS(N((R((s&/usr/lib/python2.7/test/test_socket.pyRsscSs t|_dS(N(RRm(R((s&/usr/lib/python2.7/test/test_socket.pyRs(RRRRmRsR(((s&/usr/lib/python2.7/test/test_socket.pyRs R((RRRRRmR(RRR_R((s&/usr/lib/python2.7/test/test_socket.pyRTs    (RRRT(((s&/usr/lib/python2.7/test/test_socket.pyRstTCPTimeoutTestcBs>eZdZdZejeedddZRS(cs)fd}jtj|ddS(Ncs!jjdjjdS(Ng?(RRRM(RnRo(R(s&/usr/lib/python2.7/test/test_socket.pyt raise_timeoutss*Error generating a timeout exception (TCP)(RtRR(RR((Rs&/usr/lib/python2.7/test/test_socket.pyttestTCPTimeoutscCst}y#|jjd|jj}WnMtjk rL|jdn-tjk ret}n|jdnX|s|jdndS(Ngs%caught timeout instead of error (TCP)s!caught unexpected exception (TCP)s3accept() returned success when we did not expect it( RRRRMRRR:RR(RtokRw((s&/usr/lib/python2.7/test/test_socket.pyttestTimeoutZeros Rstest needs signal.alarm()cs2|jjddtfdYfd}tjtj|}zytjdzy|jj}Wn_tjk r|j dnLk rn<|j dt j d t j fnX|j dWdtjd XWnk r|j d nXWdtjtj|XdS( Ng@tAlarmcBseZRS((RR(((s&/usr/lib/python2.7/test/test_socket.pyRscs dS(N((Rtframe(R(s&/usr/lib/python2.7/test/test_socket.pyt alarm_handlersiscaught timeout instead of Alarms3caught other exception instead of Alarm: %s(%s): %ssnothing caughtisgot Alarm in wrong place(RRR?RRRRMRRR:Rtexc_infot tracebackt format_exc(RRRRw((Rs&/usr/lib/python2.7/test/test_socket.pyttestInterruptedTimeouts,   # ( RRRRRUR)RRR(((s&/usr/lib/python2.7/test/test_socket.pyRs  tUDPTimeoutTestcBseZdZdZRS(cs)fd}jtj|ddS(Ncs$jjdjjddS(Ng?i(RRR-(RnRo(R(s&/usr/lib/python2.7/test/test_socket.pyRss*Error generating a timeout exception (UDP)(RtRR(RR((Rs&/usr/lib/python2.7/test/test_socket.pyttestUDPTimeoutscCst}y&|jjd|jjd}WnMtjk rO|jdn-tjk rht}n|jdnX|s|jdndS(Ngis%caught timeout instead of error (UDP)s!caught unexpected exception (UDP)s1recv() returned success when we did not expect it( RRRR-RRR:RR(RRRw((s&/usr/lib/python2.7/test/test_socket.pyRs (RRRR(((s&/usr/lib/python2.7/test/test_socket.pyRs tTestExceptionscBseZdZRS(cCsq|jttjt|jttjtj|jttjtj|jttjtjdS(N(Rt issubclassRRR?RqRR(R((s&/usr/lib/python2.7/test/test_socket.pyttestExceptionTree*s(RRR(((s&/usr/lib/python2.7/test/test_socket.pyR(sRsLinux specific testtTestLinuxAbstractNamespacecBs)eZdZdZdZdZRS(ilcCsd}tjtjtj}|j||jdtjtjtj}|j|j|j|j|j||j|j |dS(Ntpython-test-helloi( RtAF_UNIXRRRRQRzRMR]t getpeername(Rtaddressts1ts2((s&/usr/lib/python2.7/test/test_socket.pyttestLinuxAbstractNamespace5s   cCsTdd|jd}tjtjtj}|j||j|j|dS(NRthi(t UNIX_PATH_MAXRRRRR]Rz(RRR_((s&/usr/lib/python2.7/test/test_socket.pyt testMaxName@s cCsFdd|j}tjtjtj}|jtj|j|dS(NRR(RRRRRtRR(RRR_((s&/usr/lib/python2.7/test/test_socket.pyttestNameOverflowFs(RRRRRR(((s&/usr/lib/python2.7/test/test_socket.pyR0s t BufferIOTestcBseZdZddZdZdZdZeZdZeZ dZ dZ d Z e Z d Ze Zd Zd Zd Ze ZRS(sF Test the buffer versions of socket.recv() and socket.send(). RHcCstj|d|dS(NRI(RLR (RRI((s&/usr/lib/python2.7/test/test_socket.pyR QscCshtjddd}|jj|}|j|tt|jtt }|j|tdS(NRt i(tarrayRNt recv_intoR]RR.ttostring(RRwtnbytesR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvIntoArrayTs cCs3tjtt}WdQX|jj|dS(N(Rtcheck_py3k_warningstbufferR.RSR(RRw((s&/usr/lib/python2.7/test/test_socket.pyt_testRecvIntoArray[s cCsXtd}|jj|}|j|tt|tt }|j|tdS(Ni(t bytearrayRNRR]RR.(RRwRR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvIntoBytearray`s  cCs^td}|jjt|}|j|tt|tt }|j|tdS(Ni(RRNRRR]RR.(RRwRR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvIntoMemoryviewis  cCsntjddd}|jj|\}}|j|tt|jtt }|j|tdS(NRRi(RRNt recvfrom_intoR]RR.R(RRwRRPR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromIntoArrayrs cCs3tjtt}WdQX|jj|dS(N(RRRR.RSR(RRw((s&/usr/lib/python2.7/test/test_socket.pyt_testRecvFromIntoArrayys cCs^td}|jj|\}}|j|tt|tt }|j|tdS(Ni(RRNRR]RR.(RRwRRPR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromIntoBytearray~s  cCsdtd}|jjt|\}}|j|tt|tt }|j|tdS(Ni(RRNRRR]RR.(RRwRRPR;((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromIntoMemoryviews  cCs,td}|jt|jj|ddS(Nii(RRtRRNR(RRw((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromIntoSmallBuffers cCs3tjtt}WdQX|jj|dS(N(RRRR.RSR(RRw((s&/usr/lib/python2.7/test/test_socket.pyt_testRecvFromIntoSmallBuffers cCs0t}|jj||jj|ddS(Ni(RRNR(RRw((s&/usr/lib/python2.7/test/test_socket.pyttestRecvFromIntoEmptyBuffers (RRRFR RRRt_testRecvIntoBytearrayRt_testRecvIntoMemoryviewR R R t_testRecvFromIntoBytearrayR t_testRecvFromIntoMemoryviewR RRt_testRecvFromIntoEmptyBuffer(((s&/usr/lib/python2.7/test/test_socket.pyRLs$            iiicCsfttdstStjjds)tStd+}x!|D]}|jdr?tSq?WWdQXtS(sCheck if the TIPC module is loaded The TIPC module is not loaded automatically on Ubuntu and probably other Linux distros. tAF_TIPCs /proc/modulesstipc N( RRRR*tpathtisfiletopenRR(RR|((s&/usr/lib/python2.7/test/test_socket.pytisTipcAvailables s6TIPC module is not loaded, please 'sudo modprobe tipc'tTIPCTestcBseZdZRS(cCstjtjtj}tjtjtj}|jtjtjdtjttt f}|j |tj ttt tddf}|j t ||jd\}}|j|j||j|t dS(Niiii(RRRRRRtTIPC_ADDR_NAMESEQt TIPC_STYPEt TIPC_LOWERt TIPC_UPPERRtTIPC_ADDR_NAMER|R.R5R]Rz(RR#RJtsrvaddrtsendaddrR;trecvaddr((s&/usr/lib/python2.7/test/test_socket.pyttestRDMs    (RRR#(((s&/usr/lib/python2.7/test/test_socket.pyRstTIPCThreadableTestcBs8eZddZdZdZdZdZRS(RHcCs'tjj|d|tj|dS(NRI(RURVR R(RRI((s&/usr/lib/python2.7/test/test_socket.pyR scCstjtjtj|_|jjtjtjdtjtt t f}|jj ||jj d|j |jj\|_|_dS(Nii(RRRR#RRRRRRRRRR#RMROtconnaddr(RR ((s&/usr/lib/python2.7/test/test_socket.pyRs   cCsotjdtjtjtj|_tjttt tddf}|jj ||jj |_ dS(Ng?ii( RURVRRRRJRRRRRQRztcliaddr(RRP((s&/usr/lib/python2.7/test/test_socket.pyR<s   cCs<|jjd}|j|t|j|j|jdS(Ni(ROR-R]R.R&R%(RR;((s&/usr/lib/python2.7/test/test_socket.pyt testStreamscCs!|jjt|jjdS(N(RJRR.R(R((s&/usr/lib/python2.7/test/test_socket.pyt _testStreams(RRR RR<R'R((((s&/usr/lib/python2.7/test/test_socket.pyR$s   c Cstttttttttg }|j t t t t ttttttg |jt|jt|j ttgtj}tj|tj|dS(N(RXR,RPRRRRRKRtextendR[RhRRRRRRRRRRXRRR$Rtthreading_setupt run_unittesttthreading_cleanup(ttestst thread_info((s&/usr/lib/python2.7/test/test_socket.pyt test_mains(        t__main__(GRUttestRRRRRQRURR*RR*RRRRRbRYRRRR RRR.RRRR/R&RVRRRRGRKRLRTRXR)R,RKRPRRXR[RhRRRRRRRRRRRRRRRRRRRRRRR$R/R(((s&/usr/lib/python2.7/test/test_socket.pyts                        b hWhF?:D9U     $