Server IP : 209.38.156.173 / Your IP : 216.73.216.122 [ Web Server : Apache/2.4.52 (Ubuntu) System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.1.2-1ubuntu2.22 Disable Function : NONE Domains : 2 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/twisted/internet/test/__pycache__/ |
Upload File : |
o �bR � @ s~ d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z edkr3ddl mZmZ ddl mZ nd ZG d d� de �ZdS )zX Tests for L{twisted.internet._sigchld}, an alternate, superior SIGCHLD monitoring API. � N)�msg)�platformType)�SynchronousTestCase�posix)�installHandler�isDefaultHandler)�setNonBlockingz,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�pipe� addCleanup�closer ��self�read�write� r �D/usr/lib/python3/dist-packages/twisted/internet/test/test_sigchld.pyr s zSetWakeupSIGCHLDTests.pipec C sr t �t j�}|t jkr|| _t � t jt j� nd| _td�| _| jdur5| jdkr7td| j| jf � dS dS 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 �handlerr r r �setUp+ s ���zSetWakeupSIGCHLDTests.setUpc C sR t d� t�tjtj� | jdurt�tj| j� dS | jdkr't | j� dS 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>W s z=SetWakeupSIGCHLDTests.test_isDefaultHandler.<locals>.<lambda>N)� assertTruer r r �SIG_IGN�assertFalser r r r r �test_isDefaultHandlerM 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! r r r# r r r r �test_uninstallHandlerb s z+SetWakeupSIGCHLDTests.test_uninstallHandlerc C sd | � � \}}t|� | �ttj|d�}| �|jtj� t� t� � tj� | �t t�|d��d� dS )z� 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 �excr r r �test_installHandlerm s z)SetWakeupSIGCHLDTests.test_installHandlerN)�__name__� __module__�__qualname__�__doc__r r r r$ r&