Mini Shell

Direktori : /opt/cppython/lib/python3.8/test/__pycache__/
Upload File :
Current File : //opt/cppython/lib/python3.8/test/__pycache__/signalinterproctester.cpython-38.pyc

U

��eg�
�@sfddlZddlZddlZddlZddlZddlZGdd�de�ZGdd�dej�Z	e
dkrbe��dS)�Nc@seZdZdS)�SIGUSR1ExceptionN)�__name__�
__module__�__qualname__�rr�9/opt/cppython/lib/python3.8/test/signalinterproctester.pyr	src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�InterProcessSignalTestscCsdddd�|_dS)Nr��SIGHUP�SIGUSR1�SIGALRM��got_signals)�selfrrr�setUpszInterProcessSignalTests.setUpcCs|jdd7<dS)Nr
�r
�r�signum�framerrr�sighup_handlersz&InterProcessSignalTests.sighup_handlercCs|jdd7<t�dS)Nrr)rrrrrr�sigusr1_handlersz'InterProcessSignalTests.sigusr1_handlercCsZ|dk	r|��d}t��|}t��|krD|j|r:dSt��q |�d||f�dS)Ng$@z'signal %s not received after %s seconds)�wait�time�	monotonicr�signal�pauseZfail)r�child�signame�timeout�deadlinerrr�wait_signals

�z#InterProcessSignalTests.wait_signalcCs$d||f}tjdd|g}t�|�S)Nz)import os, signal; os.kill(%s, signal.%s)z-Iz-c)�sys�
executable�
subprocess�Popen)r�pidr�code�argsrrr�subprocess_send_signal)sz.InterProcessSignalTests.subprocess_send_signalc
CsNt�tj|j�t�tj|j�t�tjtj�t�tjtj�t	t
���}|�|d��}|�
|d�W5QRX|�|jdddd��|�t��*|�|d��}|�
|d�W5QRXW5QRX|�|jdddd��|�|d��}|��W5QRXzF|�t��t�d�|�
dd�W5QRX|�|jdddd��W5t�d�XdS)Nr
rrr	r�SIGUSR2r)rr
rrrr)�SIG_IGNr�default_int_handler�str�os�getpidr(r ZassertEqualrZassertRaisesrr�alarm�KeyboardInterrupt)rr%rrrr�test_interprocess_signal.s4� �
�z0InterProcessSignalTests.test_interprocess_signalN)	rrrrrrr r(r1rrrrr
sr�__main__)r-rr#r!rZunittest�	ExceptionrZTestCaserr�mainrrrr�<module>sE

Zerion Mini Shell 1.0