%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/internet/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/internet/test/__pycache__/test_sigchld.cpython-312.pyc

�

Ϫ�f
���dZddlmZddlZddlZddlZddlmZddlm	Z	edk(rddl
mZmZddl
mZnd	ZGd
�de	�Zy)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�H�eZdZdZd
d�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
y	)�SetWakeupSIGCHLDTestszy
    Tests for the L{signal.set_wakeup_fd} implementation of the
    L{installHandler} and L{isDefaultHandler} APIs.
    c���tj�\}}|jtj|�|jtj|�t	|�t	|�||fS)zk
        Create a non-blocking pipe which will be closed after the currently
        running test.
        )�os�pipe�
addCleanup�closer	��self�read�writes   �D/usr/lib/python3/dist-packages/twisted/internet/test/test_sigchld.pyrzSetWakeupSIGCHLDTests.pipesQ��
�g�g�i���e�������$�'�������%�(��t���u���U�{��c�t�tjtj�|_t	d�|_y)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�rs r�setUpzSetWakeupSIGCHLDTests.setUp*s'��
$*�#3�#3�F�N�N�#C�� �#�B�'��
rc��t|j�tjtj|j�y)zM
        Restore whatever signal handler was present when setUp ran.
        N)rrrrrrs r�tearDownzSetWakeupSIGCHLDTests.tearDown2s(��
	�t�z�z�"��
�
�f�n�n�d�&>�&>�?rc���|jt��tjtjtj�|jt��tjtjtj�|jt��tjtjd��|jt��y)zn
        L{isDefaultHandler} returns true if the SIGCHLD handler is SIG_DFL,
        false otherwise.
        c��y)N�)�argss r�<lambda>z=SetWakeupSIGCHLDTests.test_isDefaultHandler.<locals>.<lambda>Ds�rN)�
assertTruerrr�SIG_IGN�assertFalse�SIG_DFLrs r�test_isDefaultHandlerz+SetWakeupSIGCHLDTests.test_isDefaultHandler:s���
	
���(�*�+��
�
�f�n�n�f�n�n�5����)�+�,��
�
�f�n�n�f�n�n�5����(�*�+��
�
�f�n�n�&8�9����)�+�,rc�v�|j�\}}t|�}|jt|�|�y)zV
        L{installHandler} returns the previously registered file descriptor.
        N)rr�assertEqual)rrrrs    r�test_returnOldFDz&SetWakeupSIGCHLDTests.test_returnOldFDGs2���i�i�k���e��u�%�������.��6rc���|j�\}}|jt��t|�|j	t��td�|jt��y)zO
        C{installHandler(-1)} removes the SIGCHLD handler completely.
        rN)rr'rrr)rs   r�test_uninstallHandlerz+SetWakeupSIGCHLDTests.test_uninstallHandlerOsU���i�i�k���e����(�*�+��u�����)�+�,��r�����(�*�+rc��|j�\}}t|�|jttj
|d�}|j
|jtj�t	jt	j�tj�|j
tt	j
|d��d�y)z�
        The file descriptor passed to L{installHandler} has a byte written to
        it when SIGCHLD is delivered to the process.
        ��N)rr�assertRaises�OSErrorr
rr-�errno�EAGAIN�kill�getpidrr�len)rrr�excs    r�test_installHandlerz)SetWakeupSIGCHLDTests.test_installHandlerZs���
�i�i�k���e��u���������$��:��������E�L�L�1�
����	�	��V�^�^�,�����R�W�W�T�1�-�.��2rN)�returnztuple[int, int])r=�None)�__name__�
__module__�__qualname__�__doc__rrr!r+r.r0r<r$rrrrs+���

�(�@�-�7�	,�
3rr)rB�
__future__rr6r
r�twisted.python.runtimer�twisted.trial.unittestr�twisted.internet._signalsrr�twisted.internet.fdescr	�skiprr$rr�<module>rIs@���#��	�
�/�6��7��J�5�9�D�O3�/�O3r

Zerion Mini Shell 1.0