+
    üÐjƒ  ã                   ó¸   € R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
HtHtHtHt ^ RIHtHt ^ RIHt  ! R R	]4      t ! R
 R]4      t ! R R]4      tR# )z/
Tests for L{twisted.trial._dist.workertrial}.
N)ÚBytesIO)ÚStringTransport)ÚAMP)Ú_WORKER_AMP_STDINÚ_WORKER_AMP_STDOUTÚmanagercommandsÚworkercommandsÚworkertrial)ÚWorkerLogObserverÚmain)ÚTestCasec                   ó   € ] tR t^tRtRtR# )ÚFakeAMPz
A fake amp protocol.
© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__static_attributes__r   ó    ÚK/usr/lib/python3/dist-packages/twisted/trial/_dist/test/test_workertrial.pyr   r      s   † õr   r   c                   ó*   a € ] tR t^t o RtR tRtV tR# )ÚWorkerLogObserverTestsz!
Tests for L{WorkerLogObserver}.
c                ó¸   a€ . o ! V3R lR4      p\        V! 4       4      pVP                  RR./4       V P                  S\        P                  RR/3.4       R# )zE
L{WorkerLogObserver} forwards data to L{managercommands.TestWrite}.
c                   ó.   <a € ] tR t^*t o V3R ltRtV tR# )Ú4WorkerLogObserverTests.test_emit.<locals>.FakeClientc                ó,   <€ SP                  W34       R # ©N)Úappend)ÚselfÚmethodÚkwargsÚcallss   &&,€r   Ú
callRemoteÚ?WorkerLogObserverTests.test_emit.<locals>.FakeClient.callRemote+   s   ø€ Ø—‘˜fÐ-Ö.r   r   N)r   r   r   r   r$   r   Ú__classdictcell__)Ú__classdict__r#   s   @€r   Ú
FakeClientr   *   s   ù‡ € ÷/ó /r   r(   ÚmessagezSome logÚoutN)r
   ÚemitÚassertEqualr   Ú	TestWrite)r    r(   Úobserverr#   s   &  @r   Ú	test_emitÚ WorkerLogObserverTests.test_emit$   sX   ø€ ð ˆ÷	/ô 	/ô %¡Z£\Ó2ˆØ�‰�y : ,Ð/Ô0Ø×Ñ˜¤/×";Ñ";¸eÀZÐ=PÐ!QÐ RÖSr   r   N)r   r   r   r   r   r/   r   r&   ©r'   s   @r   r   r      s   ø‡ € ñ÷Tð Tr   r   c                   óR   a € ] tR t^3t o RtR tRR ltR tR tR t	R t
R	 tR
tV tR# )Ú	MainTestsz
Tests for L{main}.
c                óð   € \        4       V n        \        4       V n        V P                  \        R V P
                  4       V P                  \        \        R\        P                  4       R.\        n	        R# )ÚstartLoggingWithObserverÚargvÚtrialN)
r   Ú
readStreamÚwriteStreamÚpatchr	   r5   Ú
addCleanupÚsetattrÚsysr6   ©r    s   &r   ÚsetUpÚMainTests.setUp8   sP   € Ü!›)ˆŒÜ"›9ˆÔØ�
‰
ÜÐ3°T×5RÑ5Rô	
ð 	�‰œ¤ f¬c¯h©hÔ7Ø�9ŒŽr   Nc                óÄ   € V\         8X  d   V P                  RV4       V P                  # V\        8X  d   V P                  RV4       V P                  # \        RV: 24      h)z
Fake C{os.fdopen} implementation which returns C{self.readStream} for
the stdin fd and C{self.writeStream} for the stdout fd.
ÚrbÚwbzUnexpected fd )r   r,   r8   r   r9   ÚAssertionError)r    ÚfdÚmodes   &&&r   ÚfdopenÚMainTests.fdopenA   s^   € ð
 Ô"Ô"Ø×Ñ˜T 4Ô(Ø—?‘?Ð"ØÔ%Ô%Ø×Ñ˜T 4Ô(Ø×#Ñ#Ð#ä  >°"±Ð!8Ó9Ð9r   c                ó(   € V P                  V4       R# )z@
Override C{startLoggingWithObserver} for not starting logging.
N)ÚassertFalse)r    r+   Ú	setStdouts   &&&r   r5   Ú"MainTests.startLoggingWithObserverO   s   € ð 	×Ñ˜Ö#r   c                ó„   € \        V P                  4       V P                  RV P                  P	                  4       4       R# )zE
If no data is ever written, L{main} exits without writing data out.
r   N)r   rG   r,   r9   Úgetvaluer>   s   &r   Ú
test_emptyÚMainTests.test_emptyU   s/   € ô 	ˆT�[‰[ÔØ×Ñ˜˜d×.Ñ.×7Ñ7Ó9Ö:r   c                ój  € \        4       p\        4       pVP                  V4       VP                  \        P
                  RR7       VP                  V n        V P                  P                  ^ ^ 4       \        V P                  4       V P                  RV P                  P                  4       4       R# )zu
L{main} forwards data from its input stream to a L{WorkerProtocol}
instance which writes data to the output stream.
Údoesntexist)ÚtestCases
   StreamOpenN)r   r   ÚmakeConnectionr$   r   ÚRunÚior8   Úseekr   rG   ÚassertInr9   rN   )r    ÚclientÚclientTransports   &  r   Útest_forwardCommandÚMainTests.test_forwardCommand\   s†   € ô
 “ˆÜ)Ó+ˆØ×Ñ˜oÔ.Ø×Ñœ.×,Ñ,°}ÐÔEØ)×,Ñ,ˆŒØ�‰×Ñ˜Q Ô"ÜˆT�[‰[Ôð 	�‰�m T×%5Ñ%5×%>Ñ%>Ó%@ÖAr   c                óâ   a€ . o ! V3R lR4      pV! 4       V n         \        V P                  4       V P                  RV P                  P                  4       4       V P                  R.S4       R# )zt
If reading the input stream fails with a C{IOError} with errno
C{EINTR}, L{main} ignores it and continues reading.
c                   ó2   <a € ] tR t^st o ^ tV3R ltRtV tR# )Ú2MainTests.test_readInterrupted.<locals>.FakeStreamc                óÖ   <€ V ;P                   ^,          un         V P                   ^8X  d   \        \        P                  4      hSP	                  \
        P                  ! 4       4       R# )é   r   )ÚcountÚOSErrorÚerrnoÚEINTRr   r=   Úexc_info)ÚoselfÚsizeÚexcInfoss   &&€r   ÚreadÚ7MainTests.test_readInterrupted.<locals>.FakeStream.readv   sA   ø€ Ø—’˜qÕ •Ø—;‘; !Ô#Ü!¤%§+¡+Ó.Ð.à—O‘O¤C§L¢L£NÔ3Ùr   r   N©r   r   r   r   rb   rj   r   r&   )r'   ri   s   @€r   Ú
FakeStreamr_   s   s   ù‡ € ØˆE÷ó r   rm   r   N)NNN)r8   r   rG   r,   r9   rN   )r    rm   ri   s   & @r   Útest_readInterruptedÚMainTests.test_readInterruptedl   s^   ø€ ð
 ˆ÷		ô 		ñ %›,ˆŒÜˆT�[‰[ÔØ×Ñ˜˜d×.Ñ.×7Ñ7Ó9Ô:Ø×ÑÐ,Ð-¨xÖ8r   c                ó|   €  ! R R4      pV! 4       V n         V P                  \        \        V P                  4       R# )zU
L{main} only ignores C{IOError} with C{EINTR} errno: otherwise, the
error pops out.
c                   ó*   a € ] tR t^‰t o ^ tR tRtV tR# )Ú1MainTests.test_otherReadError.<locals>.FakeStreamc                óp   € V ;P                   ^,          un         V P                   ^8X  d   \        R4      hR# )ra   zSomething elseÚ )rb   rc   )rg   rh   s   &&r   rj   Ú6MainTests.test_otherReadError.<locals>.FakeStream.readŒ   s+   € Ø—’˜qÕ •Ø—;‘; !Ô#Ü!Ð"2Ó3Ð3Ùr   r   Nrl   r1   s   @r   rm   rr   ‰   s   ø‡ € ØˆE÷ð r   rm   N)r8   ÚassertRaisesÚIOErrorr   rG   )r    rm   s   & r   Útest_otherReadErrorÚMainTests.test_otherReadErrorƒ   s-   € ÷	ñ 	ñ %›,ˆŒØ×Ñœ'¤4¨¯©Ö5r   )r8   r9   r   )r   r   r   r   r   r?   rG   r5   rO   r[   rn   rx   r   r&   r1   s   @r   r3   r3   3   s3   ø‡ € ñòô:ò$ò;òBò 9÷.6ð 6r   r3   )r   rd   r=   rV   r   Útwisted.internet.testingr   Útwisted.protocols.ampr   Útwisted.trial._distr   r   r   r   r	   Útwisted.trial._dist.workertrialr
   r   Útwisted.trial.unittestr   r   r   r3   r   r   r   Ú<module>r      sV   ðñó Û 
Ý å 4Ý %÷õ ÷ DÝ +ôˆcô ôT˜Xô Tô(`6�ö `6r   