| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/internet/test/__pycache__/ |
Upload File : |
U
W[_ � @ s� d Z ddlmZmZ ddlZddlZddlZddlmZ ddl m
Z
ddlmZ edkrvddl
mZ dd lmZmZ nd
ZG dd� de�ZdS )
zX
Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD
monitoring API.
� )�division�absolute_importN)�platformType)�msg)�SynchronousTestCase�posix)�setNonBlocking)�installHandler�isDefaultHandlerz,These tests can only run on POSIX platforms.c @ sH e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dS )�SetWakeupSIGCHLDTestszy
Tests for the L{signal.set_wakeup_fd} implementation of the
L{installHandler} and L{isDefaultHandler} APIs.
c C s@ t �� \}}| �t j|� | �t j|� t|� t|� ||fS )zk
Create a non-blocking pipe which will be closed after the currently
running test.
)�os�pipeZ
addCleanup�closer ��self�read�write� r �D/usr/lib/python3/dist-packages/twisted/internet/test/test_sigchld.pyr
s zSetWakeupSIGCHLDTests.pipec C sj t �t j�}|t jkr.|| _t � t jt j� nd| _td�| _| jdk rf| jdkrftd| j| jf � dS )z�
Save the current SIGCHLD handler as reported by L{signal.signal} and
the current file descriptor registered with L{installHandler}.
N���z<Previous test didn't clean up after its SIGCHLD setup: %r %r)�signal� getsignal�SIGCHLD�SIG_DFL�signalModuleHandlerr �oldFDr )r Zhandlerr r r �setUp* s
�zSetWakeupSIGCHLDTests.setUpc C sL t d� t�tjtj� | jdk r4t�tj| j� n| jdkrHt | j� dS )zM
Restore whatever signal handler was present when setUp ran.
r N)r r r r r r �r r r r �tearDown= s
zSetWakeupSIGCHLDTests.tearDownc C sf | � t� � t�tjtj� | �t� � t�tjtj� | � t� � t�tjdd� � | �t� � dS )zn
L{isDefaultHandler} returns true if the SIGCHLD handler is SIG_DFL,
false otherwise.
c W s d S )Nr )�argsr r r �<lambda>V � z=SetWakeupSIGCHLDTests.test_isDefaultHandler.<locals>.<lambda>N)�
assertTruer
r r �SIG_IGN�assertFalser r r r r �test_isDefaultHandlerL s z+SetWakeupSIGCHLDTests.test_isDefaultHandlerc C s( | � � \}}t|�}| �t|�|� dS )zV
L{installHandler} returns the previously registered file descriptor.
N)r
r �assertEqual)r r r r r r r �test_returnOldFDZ s z&SetWakeupSIGCHLDTests.test_returnOldFDc C sD | � � \}}| �t� � t|� | �t� � td� | �t� � dS )zO
C{installHandler(-1)} removes the SIGCHLD handler completely.
r N)r
r"