+
    üÐj  ã                  óŒ   € R t ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ]R8X  d   ^ RI
HtHt ^ RIHt MRt ! R	 R
]	4      tR# )zX
Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD
monitoring API.
)ÚannotationsN)ÚplatformType)ÚSynchronousTestCaseÚposix)ÚinstallHandlerÚisDefaultHandler)ÚsetNonBlockingz,These tests can only run on POSIX platforms.c                  ón   € ] tR t^tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltRtR# )ÚSetWakeupSIGCHLDTestszm
Tests for the L{signal.set_wakeup_fd} implementation of the
L{installHandler} and L{isDefaultHandler} APIs.
c               ó   € V ^8„  d   QhRR/# )é   Úreturnztuple[int, int]© )Úformats   "ÚD/usr/lib/python3/dist-packages/twisted/internet/test/test_sigchld.pyÚ__annotate__Ú"SetWakeupSIGCHLDTests.__annotate__   s   € ÷ 
ñ 
�oñ 
ó    c                óâ   € \         P                  ! 4       w  rV P                  \         P                  V4       V P                  \         P                  V4       \	        V4       \	        V4       W3# )zS
Create a non-blocking pipe which will be closed after the currently
running test.
)ÚosÚpipeÚ
addCleanupÚcloser   ©ÚselfÚreadÚwrites   &  r   r   ÚSetWakeupSIGCHLDTests.pipe   sM   € ô
 —g’g“i‰ˆØ�‰œŸ™ $Ô'Ø�‰œŸ™ %Ô(Ü�tÔÜ�uÔØˆ{Ðr   c               ó   € V ^8„  d   QhRR/# ©r   r   ÚNoner   )r   s   "r   r   r   *   s   € ÷ (ñ (�tñ (r   c                óx   € \         P                  ! \         P                  4      V n        \	        R4      V n        R# )z…
Save the current SIGCHLD handler as reported by L{signal.signal} and
the current file descriptor registered with L{installHandler}.
Néÿÿÿÿ)ÚsignalÚ	getsignalÚSIGCHLDÚsignalModuleHandlerr   ÚoldFD©r   s   &r   ÚsetUpÚSetWakeupSIGCHLDTests.setUp*   s'   € ô
 $*×#3Ò#3´F·N±NÓ#CˆÔ Ü# BÓ'ˆŽ
r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   2   s   € ÷ @ñ @˜$ñ @r   c                óŽ   € \        V P                  4       \        P                  ! \        P                  V P                  4       R# )z=
Restore whatever signal handler was present when setUp ran.
N)r   r'   r#   r%   r&   r(   s   &r   ÚtearDownÚSetWakeupSIGCHLDTests.tearDown2   s(   € ô
 	�t—z‘zÔ"Ü�Š”f—n‘n d×&>Ñ&>Ö?r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   :   s   € ÷ -ñ - tñ -r   c                óæ  € V P                  \        4       4       \        P                  ! \        P                  \        P                  4       V P                  \        4       4       \        P                  ! \        P                  \        P                  4       V P                  \        4       4       \        P                  ! \        P                  R 4       V P                  \        4       4       R# )zV
L{isDefaultHandler} returns true if the SIGCHLD handler is SIG_DFL,
false otherwise.
c                 ó   € R # )Nr   )Úargss   *r   Ú<lambda>Ú=SetWakeupSIGCHLDTests.test_isDefaultHandler.<locals>.<lambda>D   s   € ±Dr   N)Ú
assertTruer   r#   r%   ÚSIG_IGNÚassertFalseÚSIG_DFLr(   s   &r   Útest_isDefaultHandlerÚ+SetWakeupSIGCHLDTests.test_isDefaultHandler:   s‡   € ð
 	�‰Ô(Ó*Ô+Ü�Š”f—n‘n¤f§n¡nÔ5Ø×ÑÔ)Ó+Ô,Ü�Š”f—n‘n¤f§n¡nÔ5Ø�‰Ô(Ó*Ô+Ü�Š”f—n‘nÑ&8Ô9Ø×ÑÔ)Ó+Ö,r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   G   s   € ÷ 7ñ 7 $ñ 7r   c                óv   € V P                  4       w  r\        V4      pV P                  \        V4      V4       R# )zF
L{installHandler} returns the previously registered file descriptor.
N)r   r   ÚassertEqual)r   r   r   r'   s   &   r   Útest_returnOldFDÚ&SetWakeupSIGCHLDTests.test_returnOldFDG   s0   € ð —i‘i“k‰ˆÜ˜uÓ%ˆØ×Ñœ¨Ó.°Ö6r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   O   s   € ÷ 	,ñ 	, tñ 	,r   c                óì   € V P                  4       w  rV P                  \        4       4       \        V4       V P	                  \        4       4       \        R4       V P                  \        4       4       R# )z?
C{installHandler(-1)} removes the SIGCHLD handler completely.
Nr"   )r   r5   r   r   r7   r   s   &  r   Útest_uninstallHandlerÚ+SetWakeupSIGCHLDTests.test_uninstallHandlerO   sS   € ð —i‘i“k‰ˆØ�‰Ô(Ó*Ô+Ü�uÔØ×ÑÔ)Ó+Ô,Ü�rÔØ�‰Ô(Ó*Ö+r   c               ó   € V ^8„  d   QhRR/# r   r   )r   s   "r   r   r   Z   s   € ÷ 3ñ 3 Tñ 3r   c                ó°  € V P                  4       w  r\        V4       V P                  \        \        P
                  V^4      pV P                  VP                  \        P                  4       \        P                  ! \        P                  ! 4       \        P                  4       V P                  \        \        P
                  ! V^4      4      ^4       R# )zt
The file descriptor passed to L{installHandler} has a byte written to
it when SIGCHLD is delivered to the process.
N)r   r   ÚassertRaisesÚOSErrorr   r   r=   ÚerrnoÚEAGAINÚkillÚgetpidr#   r%   Úlen)r   r   r   Úexcs   &   r   Útest_installHandlerÚ)SetWakeupSIGCHLDTests.test_installHandlerZ   sƒ   € ð
 —i‘i“k‰ˆÜ�uÔà×Ñ¤¬¯©°$¸Ó:ˆØ×Ñ˜Ÿ™¤E§L¡LÔ1ä
�Š”—	’	“œVŸ^™^Ô,à×ÑœœRŸWšW T¨1Ó-Ó.°Ö2r   )r'   r&   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r)   r-   r9   r>   rB   rN   Ú__static_attributes__r   r   r   r
   r
      s0   † ñõ

õ(õ@õ-õ7õ	,÷3ñ 3r   r
   )rT   Ú
__future__r   rH   r   r#   Útwisted.python.runtimer   Útwisted.trial.unittestr   Útwisted.internet._signalsr   r   Útwisted.internet.fdescr   Úskipr
   r   r   r   Ú<module>r\      s@   ðñõ #ã Û 	Û å /Ý 6à�7ÔßJÞ5à9€DôO3Ð/ö O3r   