CasperSecurity

Current Path : /lib/python3/dist-packages/supervisor/tests/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/supervisor/tests/__pycache__/test_process.cpython-310.pyc

o

�^�\V��@sjddlZddlZddlZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZddl	m
Z
ddl	mZddl	mZddl	mZdd	l	mZdd
l	mZddl	mZddl	mZdd
l	mZddl	mZddlmZddlmZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�dej�Z Gdd�de�Z!Gdd�dej�Z"dS)�N)�as_bytes��maxint)�Mock�patch�sentinel)�DummyOptions)�DummyPConfig)�DummyProcess)�DummyPGroupConfig)�DummyDispatcher)�
DummyEvent)�DummyFCGIGroupConfig)�DummySocketConfig)�DummyProcessGroup)�DummyFCGIProcessGroup��
Subprocess)�
BadCommandc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Z d=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2dadb�Z3dcdd�Z4dedf�Z5dgdh�Z6didj�Z7dkdl�Z8dmdn�Z9dodp�Z:dqdr�Z;dsdt�Z<dudv�Z=dwdx�Z>dydz�Z?d{d|�Z@d}d~�ZAdd��ZBd�d��ZCd�d��ZDd�d��ZEd�d��ZFd�d��ZGd�d��ZHd�d��ZId�d��ZJd�d��ZKd�d��ZLd�d��ZMd�d��ZNd�d��ZOd�d��ZPd�d��ZQd�d��ZRd�d��ZSd�d��ZTd�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYd�d��ZZd�S)��SubprocessTestscC�ddlm}|S)Nrr)�supervisor.processr)�selfr�r�?/usr/lib/python3/dist-packages/supervisor/tests/test_process.py�_getTargetClass�zSubprocessTests._getTargetClasscO�|��|i|��S�N�r�r�arg�kwrrr�_makeOne�zSubprocessTests._makeOnecC�ddlm}|�dS�Nr)�clear��supervisor.eventsr'�rr'rrr�tearDown"�
zSubprocessTests.tearDowncCsJddlm}ddlm}|j��D]\}}t|t�r"|�||�|�qdS)Nr��
ProcessStates)�getProcessStateDescription)	�supervisor.statesr.rr/�__dict__�items�
isinstance�int�assertEqual)rr.r/�	statename�coderrr�test_getProcessStateDescription&s
��z/SubprocessTests.test_getProcessStateDescriptioncCs�t�}t|ddddd�}|�|�}|�|j|�|�|jj|�|�|jd�|�|jd�|�|jd�|�|jd�|�|j	d�|�
|j�|�
|j�|�|j
d�|�|ji�|�|ji�|�|jd�dS)N�cat�bin/catz/tmp/temp123.logz/tmp/temp456.log��stdout_logfile�stderr_logfiler)rr	r#r5�config�options�	laststart�pid�laststop�delay�assertFalse�administrative_stop�killing�backoff�pipes�dispatchers�spawnerr�rr?r>�instancerrr�	test_ctor-s&�
zSubprocessTests.test_ctorcCsHt�}t|dd�}|�|�}t|�}|�|�d��|�|�d��dS)Nr9r:z<Subprocess atzwith name cat in state STOPPED>)rr	r#�repr�
assertTrue�
startswith�endswith)rr?r>rL�srrr�	test_reprAs
zSubprocessTests.test_reprcC�ht�}t|dd�}|�|�}tdd�tdd�d�|_|��|�|jdjd�|�|jdjd	�dS�
N�test�/testT��readable��writable�r�rr]F)rr	r#rrI�
reopenlogsr5�
logs_reopenedrKrrr�test_reopenlogsI�
�zSubprocessTests.test_reopenlogscCrTrU)rr	r#rrI�
removelogsr5�logs_removedrKrrr�test_removelogsSrazSubprocessTests.test_removelogscCsjt�}t|ddddd�}|�|�}tdd�tdd�d	�|_|��|�|jd
j�|�|jdj�dS)NrVrW�/tmp/fooz/tmp/barr;TrXrZr\rr])	rr	r#rrI�drainrO�read_event_handled�write_event_handledrKrrr�
test_drain]s�
�zSubprocessTests.test_draincC�.t�}t|dd�}|�|�}|�t|j�dS)N�
extraquotezextraquote"�rr	r#�assertRaisesr�get_execv_argsrKrrr�*test_get_execv_args_bad_command_extraquotei�
z:SubprocessTests.test_get_execv_args_bad_command_extraquotecCrj)N�empty�rlrKrrr�%test_get_execv_args_bad_command_emptyorpz5SubprocessTests.test_get_execv_args_bad_command_emptycCrj)N�whitespaceonlyz 	 rlrKrrr�.test_get_execv_args_bad_command_whitespaceonlyurpz>SubprocessTests.test_get_execv_args_bad_command_whitespaceonlycCs:t�}t|dd�}|�|�}|��}|�|ddgf�dS)N�notthere�	/notthere�rr	r#rnr5�rr?r>rL�argsrrr�test_get_execv_args_abs_missing{�

z/SubprocessTests.test_get_execv_args_abs_missingcCs<t�}t|dd�}|�|�}|��}|�|dddgf�dS)Nrvz/notthere "an argument"rw�an argumentrxryrrr�*test_get_execv_args_abs_withquotes_missing��

z:SubprocessTests.test_get_execv_args_abs_withquotes_missingcCs:t�}t|dd�}|�|�}|��}|�|ddgf�dS)Nrvrxryrrr�test_get_execv_args_rel_missing�r|z/SubprocessTests.test_get_execv_args_rel_missingcCs<t�}t|dd�}|�|�}|��}|�|dddgf�dS)Nrvznotthere "an argument"r}rxryrrr�*test_get_execv_args_rel_withquotes_missing�rz:SubprocessTests.test_get_execv_args_rel_withquotes_missingcCs`d}t�}t|d|�}|�|�}|��}|�t|�d�|�|dd�|�|dddg�dS)Nz/bin/sh foo�sh�r�/bin/shr]�foo�rr	r#rnr5�len�r�
executabler?r>rLrzrrr�test_get_execv_args_abs��
z'SubprocessTests.test_get_execv_args_abscCs`d}t�}t|d|�}|�|�}|��}|�t|�d�|�|dd�|�|dddg�dS)Nzsh foor�r�rr�r]r�r�r�rrr�test_get_execv_args_rel�r�z'SubprocessTests.test_get_execv_args_relcs�t���B}tj�|j�\�}d|}t�}t|d|�}�fdd�|_|�	|�}|�
�}|�|d|j�|�|d|dg�Wd�dS1sIwYdS)Nz%s foor�cs�gSrrr��dirnamerr�<lambda>�szUSubprocessTests.test_get_execv_args_rel_searches_using_pconfig_path.<locals>.<lambda>rr]r�)�tempfile�NamedTemporaryFile�os�path�split�namerr	�get_pathr#rnr5)r�f�basenamer�r?r>rLrzrr�r�3test_get_execv_args_rel_searches_using_pconfig_path�s

"�zCSubprocessTests.test_get_execv_args_rel_searches_using_pconfig_pathcCsLt�}t|dd�}|�|�}|�d�|�|jd�|�|jjdd�dS)NrVrWr�rz
spawnerr: foo)rr	r#�record_spawnerrr5rJ�logger�datarKrrr�test_record_spawnerr�s

z$SubprocessTests.test_record_spawnerrcCsrt�}t|dd�}|�|�}d|_ddlm}|j|_|��}|�	|d�|�	|j
jdd�|�	|j|j�dS)Nr�r�Trr-zprocess 'sh' already running)rr	r#rAr0r.�RUNNING�state�spawnr5r�r�)rr?r>rLr.�resultrrr�test_spawn_already_running�s
z*SubprocessTests.test_spawn_already_runningc	st�}t|dd�}|�|�}ddlm}|j|_ddlm}g�|�	|j
�fdd��|��}|�|d�|�|j
d�|�|jjdd	�|�|j�|�|j�ddlm}|�|j|j�|�t��d
��d}�d}|�|j|j�|�|j|j�dS)N�badz
/bad/filenamerr-��eventsc�
��|�Sr��append��x��Lrrr���
zBSubprocessTests.test_spawn_fail_check_execv_args.<locals>.<lambda>zbad filenamezspawnerr: bad filenamer�r])rr	r#r0r.�BACKOFFr��
supervisorr��	subscribe�ProcessStateEventr�r5rJr�r�rOrCrGr��	__class__�ProcessStateStartingEvent�ProcessStateBackoffEvent�	rr?r>rLr.r�r��event1�event2rr�r� test_spawn_fail_check_execv_args�s*
z0SubprocessTests.test_spawn_fail_check_execv_argsc	st�}tj|_t|dd�}|�|�}ddlm}|j|_	ddl
m}g�|�|j
�fdd��|��}|�|d�|�|jd�|�|jjdd	�|�|j�|�|j�ddlm}|�|j	|j�|�t��d
��\}}|�|j|j�|�|j|j�dS)N�good�/good/filenamerr-r�cr�rr�r�r�rrr��r�zCSubprocessTests.test_spawn_fail_make_pipes_emfile.<locals>.<lambda>z#too many open files to spawn 'good'z-spawnerr: too many open files to spawn 'good'r�)r�errno�EMFILE�make_pipes_errorr	r#r0r.r�r�r�r�r�r�r�r5rJr�r�rOrCrGr�r�r�r�r�rr�r�!test_spawn_fail_make_pipes_emfile�s2
��z1SubprocessTests.test_spawn_fail_make_pipes_emfilec
s
t�}d|_t|dd�}|�|�}ddlm}|j|_ddlm	}g�|�
|j�fdd��|��}|�
|d�d	}|�
|j|�|�
|jjdd
|�|�|j�|�|j�ddlm}|�
|j|j�|�
t��d��\}}	|�
|j|j�|�
|	j|j�dS)Nr]r�r�rr-r�cr�rr�r�r�rrr�r�zBSubprocessTests.test_spawn_fail_make_pipes_other.<locals>.<lambda>z2unknown error making dispatchers for 'good': EPERM�spawnerr: %sr�)rr�r	r#r0r.r�r�r�r�r�r�r�r5rJr�r�rOrCrGr�r�r�r��
rr?r>rLr.r�r��msgr�r�rr�r� test_spawn_fail_make_pipes_other�s,
z0SubprocessTests.test_spawn_fail_make_pipes_othercst�}t|dddd�}dd�}||_|�|�}ddlm}|j|_dd	lm	}g�|�
|j�fd
d��|��}|�
|d�d}|�
|j|�|�
|jjdd
|�|�|j�|�|j�ddlm}|�
|j|j�|�
t��d��\}	}
|�
|	j|j�|�
|
j|j�dS)Nr9�/bin/catz/a/directory)r��commandr<cS�
ttj��r)�IOErrorr��EISDIR��enveloperrr�raise_eisdir�
zMSubprocessTests.test_spawn_fail_make_dispatchers_eisdir.<locals>.raise_eisdirrr-r�cr�rr�r�r�rrr�r�zISubprocessTests.test_spawn_fail_make_dispatchers_eisdir.<locals>.<lambda>z2unknown error making dispatchers for 'cat': EISDIRr�r�)rr	�make_dispatchersr#r0r.r�r�r�r�r�r�r�r5rJr�r�rOrCrGr�r�r�r�)rr?r>r�rLr.r�r�r�r�r�rr�r�'test_spawn_fail_make_dispatchers_eisdirs2�
z7SubprocessTests.test_spawn_fail_make_dispatchers_eisdirc
s0t�}tj|_t|dd�}|�|�}ddlm}|j|_	ddl
m}g�|�|j
�fdd��|��}|�|d�d}|�|j|�|�|jjdd	|�|�t|j�d
�|�t|j�d
�|�|j�|�|j�ddlm}|�|j	|j�|�t��d��\}}	|�|j|j�|�|	j|j�dS)Nr�r�rr-r�cr�rr�r�r�rrr�7r�z=SubprocessTests.test_spawn_fork_fail_eagain.<locals>.<lambda>z3Too many processes in process table to spawn 'good'r��r�)rr��EAGAIN�
fork_errorr	r#r0r.r�r�r�r�r�r�r�r5rJr�r�r��parent_pipes_closed�child_pipes_closedrOrCrGr�r�r�r�rr�r�test_spawn_fork_fail_eagain.s0
z+SubprocessTests.test_spawn_fork_fail_eagainc
s.t�}d|_t|dd�}|�|�}ddlm}|j|_ddlm	}g�|�
|j�fdd��|��}|�
|d�d	}|�
|j|�|�
|jjdd
|�|�
t|j�d�|�
t|j�d�|�|j�|�|j�ddlm}|�
|j|j�|�
t��d��\}}	|�
|j|j�|�
|	j|j�dS)
Nr]r�r�rr-r�cr�rr�r�r�rrr�Qr�z<SubprocessTests.test_spawn_fork_fail_other.<locals>.<lambda>z+unknown error during fork for 'good': EPERMr�r�r�)rr�r	r#r0r.r�r�r�r�r�r�r�r5rJr�r�r�r�r�rOrCrGr�r�r�r�rr�r�test_spawn_fork_fail_otherHs0
z*SubprocessTests.test_spawn_fork_fail_othercCs�t�}d|_t|dddd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|jd�|�t	|j
�d�|�t	|j�|jd�|�|j
d�|�|jddgf�|�|jd�|�|jdd	i�dS)
Nrr�r�r]��uidT�r��*supervisor: child process was not spawned
)r�forkpidr	r#r�r5r�r��pgrp_setr��duped�
fds_closed�minfds�privsdropped�
execv_args�
execve_called�written�rr?r>rLr�rrr�test_spawn_as_child_setuid_okbs&
��z-SubprocessTests.test_spawn_as_child_setuid_okcCs�t�}d|_d|_t|dddd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|j	d�|�t
|j�d�|�t
|j�|j
d�|�|jd	d
i�|�|jd�|�|jd�|�|jd�dS)
Nrzfailure reasonr�r�r]r�Tr�r�z[supervisor: couldn't setuid to 1: failure reason
supervisor: child process was not spawned
F�)rr��
setuid_msgr	r#r�r5r�r�r�r�r�r�r�r�r�r��	_exitcoder�rrr�test_spawn_as_child_setuid_failxs$
�z/SubprocessTests.test_spawn_as_child_setuid_failcCs�t�}d|_t|dddd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|jd�|�t	|j
�d�|�t	|j�|jd�|�|j
ddgf�|�|jd�|�|jd�|�|jdd	i�dS)
Nrr�r��/tmp��	directoryTr�r�r�)rr�r	r#r�r5r�r�r�r�r�r�r�r��changed_directoryr�r�r�rrr�test_spawn_as_child_cwd_ok�s*�
��z*SubprocessTests.test_spawn_as_child_cwd_okcCs�t�}d|_t|dddd�}|�|�}|��}|�|d�|�|jddgf�|�|jd�|�|jd�|�|j	ddi�dS)Nrr�r�r�)�umaskTr�)
rr�r	r#r�r5r��umasksetr�r�r�rrr�test_spawn_as_child_sets_umask�s
��z.SubprocessTests.test_spawn_as_child_sets_umaskcCs�t�}d|_d|_t|dddd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|j	d�|�t
|j�d�|�t
|j�|j
d�|�|jd�dd	i}|�|j|�|�|jd
�|�|jd�|�|jd�dS)Nrr�r�r�r�r�Tr�zUsupervisor: couldn't chdir to /tmp: ENOENT
supervisor: child process was not spawned
r�F)rr��chdir_errorr	r#r�r5r�r�r�r�r�r�r�r�r�r�r�r��rr?r>rLr��outrrr�test_spawn_as_child_cwd_fail�s(�
z,SubprocessTests.test_spawn_as_child_cwd_failcCs�t�}d|_d|_t|dd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|j	d�|�t
|j�d�|�t
|j�|j
d�ddi}|�|j|�|�|jd�|�|jd	�dS)
Nrr]r�r�Tr�r�zZsupervisor: couldn't exec /good/filename: EPERM
supervisor: child process was not spawned
r�)rr��execv_errorr	r#r�r5r�r�r�r�r�r�r�r�r�r�r�rrr�&test_spawn_as_child_execv_fail_oserror�s 
z6SubprocessTests.test_spawn_as_child_execv_fail_oserrorcCs�t�}d|_d|_t|dd�}|�|�}|��}|�|d�|�|jd�|�|jd�|�|j	d�|�t
|j�d�|�t
|j�|j
d�|jd}d}|�|�|��|�d|v�|�|jd�|�|jd	�dS)
Nrr�r�r�Tr�z)supervisor: couldn't exec /good/filename:�RuntimeErrorr�)rr�r�r	r#r�r5r�r�r�r�r�r�r�r�rOrPr�r�)rr?r>rLr�r��headrrr�,test_spawn_as_child_execv_fail_runtime_error�s$

z<SubprocessTests.test_spawn_as_child_execv_fail_runtime_errorcCsht�}d|_t|ddddid�}|�|�}|��}|�|d�|�|jddgf�|�|jdd�dS)Nrr9r��_TEST_�1)�environment)rr�r	r#r�r5r��execv_environmentr�rrr�,test_spawn_as_child_uses_pconfig_environment�s�
z<SubprocessTests.test_spawn_as_child_uses_pconfig_environmentcCs�t�}d|_t|dd�}|�|�}Gdd�d�}|�|_|�|j_|��}|�|d�|�|jddgf�|�|j	dd�|�|j	dd�|�|j	d	d
�|�|j	dd�dS)
Nrr9r�c@�eZdZdZdS)zQSubprocessTests.test_spawn_as_child_environment_supervisor_envvars.<locals>.Dummy�dummyN)�__name__�
__module__�__qualname__r�rrrr�Dummy�r�SUPERVISOR_ENABLEDr��SUPERVISOR_PROCESS_NAME�SUPERVISOR_GROUP_NAMEr��SUPERVISOR_SERVER_URLzhttp://localhost:9001)
rr�r	r#�groupr>r�r5r�r�)rr?r>rLrr�rrr�2test_spawn_as_child_environment_supervisor_envvars�s.


�
�
��zBSubprocessTests.test_spawn_as_child_environment_supervisor_envvarscCs�t�}d|_t|dddd�}d|_|�|�}|��}|�|d�|�|jd�|�|jd�|�|j	d�|�t
|j�d�|�t
|j�|j
d�|�|jd�|�|jddgf�|�|jd�|�|jdd	i�dS)
Nrr�r�r]r�Tr�r�r�)rr�r	�redirect_stderrr#r�r5r�r�r�r�r�r�r�r�r�r�r�r�rrr�%test_spawn_as_child_stderr_redirecteds(
��z5SubprocessTests.test_spawn_as_child_stderr_redirectedcCs,t�}d|_t|dd�}|�|�}|��}|�|d�|�|jdjt�|�|jdjt�|�|jdjt�|�|j	dd�|�|j	dd�|�|j	d	d�|�|j
d�|�t|j�d
�|�|j
jdd�|�|jd�|�|j�|�|jjjd|�dd
lm}|�|j|j�dS)N�
r�r�����stdin�stdout�stderrr�rzspawned: 'good' with pid 10r-)rr�r	r#r�r5rIr�rrHr�r�r�r�r�rJrOrCr>r?�
pidhistoryr0r.r��STARTING)rr?r>rLr�r.rrr�test_spawn_as_parent)s(
z$SubprocessTests.test_spawn_as_parentcCs�t�}d|_t|dddd�}|�|�}|��}|�|d�|�|jdjt�|�|jdjt�|�|j	dd�|�|j	d	d�|�|j	d
d�dS)Nr
r�r�T)rrrrrr)
rr�r	r#r�r5rIr�rrHr�rrr�test_spawn_redirect_stderr?s�
z*SubprocessTests.test_spawn_redirect_stderrcCs�d}t�}t|d|�}|�|�}dd}|�t|j|�d|_|��|�|�|jd}|�	||j
|j�d|_|�t|j|�dS)Nr��output�a� r]rT)
rr	r#rm�OSError�writer�r�rHr5rI�input_bufferrF�rr�r?r>rL�sent�stdin_fdrrr�
test_writeMs


zSubprocessTests.test_writecCsrd}t�}t|d|�}|�|�}dd}|�t|j|�d|_|��|jd}|j	|�
�|�t|j|�dS�Nr�rrrr]r)rr	r#rmrrr�r�rHrI�closerrrr�test_write_dispatcher_closed\�

z,SubprocessTests.test_write_dispatcher_closedc
Cs�d}t�}t|d|�}|�|�}d|_|��|jd}|j|��d|jd<z
|�d�|�	d�WdSt
y[}z|�|jdt
j�|�|jdd�WYd}~dSd}~ww)	Nr�rr]rr��nothing raisedrzProcess has no stdin channel)rr	r#r�r�rHrIr#r�failrr5rzr��EPIPE)rr�r?r>rLr �excrrr�test_write_stdin_fd_noneis"



 ��z(SubprocessTests.test_write_stdin_fd_nonecCsrd}t�}t|d|�}|�|�}dd}|�t|j|�d|_|��|jd}t	j
|j|_|�t|j|�dSr")
rr	r#rmrrr�r�rHr�r(rI�flush_errorrrrr�(test_write_dispatcher_flush_raises_epipezr%z8SubprocessTests.test_write_dispatcher_flush_raises_epipecs�ddlm}z�g��fdd�}t�tj|�|�}t�}t|d|�}|�|�}|��}|jj	d}|�
|�d��|�t
|j�d�|�
|j�|�|j|�|j}		z	t�d	���}
Wntyw}z|jdtjkrm�WYd}~nd}~wwqSt�d
�|�
|
�tt|	���dk�|�tj�}t�d
�|�|d�t�dtj�\}}
t�d	���}
|�|
�tt|	���d�|� �g�Wzt�!|�WnYt�tjtj"�dSzt�!|�WnYt�tjtj"�w)Nr)�makeSpewcs��d�dS)NTr�)rz��sigchldsrr�
sighandler�sz=SubprocessTests._dont_test_spawn_and_kill.<locals>.sighandler�spewzspawned: 'spew' with pidr�r]�psg�������?���)#�supervisor.tests.baser-�signal�SIGCHLDrr	r#r�r�r�rOrPr5r�rHrAr��popen�readr�rzr��EINTR�time�sleep�findrrN�kill�SIGTERM�waitpid�WNOHANG�assertNotEqual�remove�SIG_DFL)rr-r0r�r?r>rLr�r��origpidr��whyrA�stsrr.r�_dont_test_spawn_and_kill�s\
����

�z)SubprocessTests._dont_test_spawn_and_killcCs�t�}t|dd�}|�|�}d|_tdd�}d|i|_ddlm}|j|_	t
�
�|_|��|�
|j�|�|jd�|�
|j�|�|jjdd	�|�
|j�|�|jdtj�dS)
NrVrW�TrZr�rr-�)killing test (pid 11) with signal SIGTERM)rr	r#rArrIr0r.r�r�r:�laststopreport�stoprOrEr5rCr�r�rF�killsr5r>�rr?r>rL�
dispatcherr.rrr�	test_stop�s 



zSubprocessTests.test_stopc
Cs�t�}t|dd�}|�|�}d|_tdd�}d|i|_ddlm}|j|_	z|�
�|�d	�WdStyM}z|�
|jdd
�WYd}~dSd}~ww)NrVrWrHTrZr�rr-r&zCAssertion failed for test: STOPPED not in RUNNING STARTING STOPPING)rr	r#rArrIr0r.�STOPPEDr�rKr'�AssertionErrorr5rz)rr?r>rLrNr.r)rrr�&test_stop_not_in_stoppable_state_error�s


 ��z6SubprocessTests.test_stop_not_in_stoppable_state_errorcCsjt�}t|dd�}|�|�}d|_tdd�}d|i|_ddlm}|j|_	|�
�|�t|j
j�d�dS)	NrVrWrHTrZr�rr-)rr	r#rArrIr0r.rPr��stop_reportr5r�r�r�rMrrr�3test_stop_report_logs_nothing_if_not_stopping_state�s


zCSubprocessTests.test_stop_report_logs_nothing_if_not_stopping_statecCs�t�}t|dd�}|�|�}d|_tdd�}d|i|_ddlm}|j|_	|�
|jd�|��|�
t
|jj�d	�|�
|jjdd
�|�|jd�|��|�
t
|jj�d	�dS)NrVrWrHTrZr�rr-r]�waiting for test to stop)rr	r#rArrIr0r.�STOPPINGr�r5rJrSr�r�r�rArMrrr�1test_stop_report_logs_throttled_by_laststopreport�s


zASubprocessTests.test_stop_report_logs_throttled_by_laststopreportcCs�t��d}t�}t|dd�}|�|�}d|_tdd�}d|i|_dd	lm}|j	|_
||_|��|�
t|jj�d�|�|j|k�t�d
�|��|�
t|jj�d�|�
|jjdd�|�|jd�|��|�
t|jj�d�dS)
N�rVrWrHTrZr�rr-r�r]rU)r:rr	r#rArrIr0r.rVr�rJrSr5r�r�r�rOr;rA)r�future_timer?r>rLrNr.rrr�)test_stop_report_laststopreport_in_future�s(



z9SubprocessTests.test_stop_report_laststopreport_in_futurecs�t�}t|dd�}|�|�}g�ddlm}ddlm}|�|j�fdd��|j	|_
|��|�|j
�|�|j�|�|j�|�|j
|j�|�t��d��d}|�|j|j�dS)	NrVrWrr-r�cr�rr�r�r�rrr�r�z.SubprocessTests.test_give_up.<locals>.<lambda>r])rr	r#r0r.r�r�r�r�r�r��give_uprO�system_stoprDrCrGr5�FATALr�r��ProcessStateFatalEvent�rr?r>rLr.r��eventrr�r�test_give_ups 
zSubprocessTests.test_give_upcCsLt�}t|dd�}|�|�}|�tj�|�|jjdd�|�	|j
�dS)NrVrWrz=attempted to kill test with sig SIGTERM but it wasn't running)rr	r#r=r5r>r5r�r�rDrFrKrrr�test_kill_nopid&s
�zSubprocessTests.test_kill_nopidcst�}t|dd�}d|_|�|�}g�ddlm}ddlm}|�|j	�fdd��d	|_
|j|_|�
tj�|�|jjdd
�|�|jjd�d��|�d|jjdv�|�|j�|�t��d
��d}�d}|�|j|j�|�|j|j�dS)NrVrWr]rr-r�cr�rr�r�r�rrr�7r�z1SubprocessTests.test_kill_error.<locals>.<lambda>rHrIzunknown problem killing test�	Tracebackr�)rr	�
kill_errorr#r0r.r�r�r�r�rAr�r�r=r5r>r5r�r�rOrPrDrFr�r��ProcessStateStoppingEvent�ProcessStateUnknownEvent)rr?r>rLr.r�r�r�rr�r�test_kill_error/s,
�zSubprocessTests.test_kill_errorc��t�}t|dd�}|�|�}d|_g�ddlm}ddlm}|�|j	�fdd��|j
|_|�t
j�|�|jjdd	�|�|j�|�|jdt
j�|�t��d
��d}|�|j|j�dS)NrVrWrHrr-r�cr�rr�r�r�rrr�Or�z9SubprocessTests.test_kill_from_starting.<locals>.<lambda>rIr])rr	r#rAr0r.r�r�r�r�rr�r=r5r>r5r�r�rOrFrLr�r�rer_rr�r�test_kill_from_startingG� 
z'SubprocessTests.test_kill_from_startingcrh)NrVrWrHrr-r�cr�rr�r�r�rrr�br�z8SubprocessTests.test_kill_from_running.<locals>.<lambda>rIr])rr	r#rAr0r.r�r�r�r�r�r�r=r5r>r5r�r�rOrFrLr�r�rer_rr�r�test_kill_from_runningZrjz&SubprocessTests.test_kill_from_runningcs�t�}t|dd�}|�|�}d|_g�ddlm}ddlm}|�|j	�fdd��|j
|_|�t
j�|�|jjdd	�|�|j�|�|jdt
j�|��g�dS)
NrVrWrHrr-r�cr�rr�r�r�rrr�ur�z9SubprocessTests.test_kill_from_stopping.<locals>.<lambda>z)killing test (pid 11) with signal SIGKILL�rr	r#rAr0r.r�r�r�r�rVr�r=r5�SIGKILLr5r�r�rOrFrL�rr?r>rLr.r�rr�r�test_kill_from_stoppingms
z'SubprocessTests.test_kill_from_stoppingcs�t�}t|dd�}|�|�}g�ddlm}ddlm}|�|j�fdd��|j	|_
|�tj
�|�|jjdd�|�|j��d}|�|j|j�dS)	NrVrWrr-r�cr�rr�r�r�rrr��r�z8SubprocessTests.test_kill_from_backoff.<locals>.<lambda>z2Attempted to kill test, which is in BACKOFF state.)rr	r#r0r.r�r�r�r�r�r�r=r5rmr5r�r�rDrFr��ProcessStateStoppedEventr_rr�r�test_kill_from_backoff~s
�z&SubprocessTests.test_kill_from_backoffcs�t�}t|dddd�}|�|�}d|_g�ddlm}ddlm}|�|j	�fd	d
��|j
|_|�t
j�|�|jjdd�|�|j�|�|jdt
j�|��g�dS)
NrVrWT)�killasgrouprHrr-r�cr�rr�r�r�rrr��r�zGSubprocessTests.test_kill_from_stopping_w_killasgroup.<locals>.<lambda>z7killing test (pid 11) process group with signal SIGKILL���rlrnrr�r�%test_kill_from_stopping_w_killasgroup�s
z5SubprocessTests.test_kill_from_stopping_w_killasgroupcs�t�}t|dddd�}|�|�}d|_g�ddlm}ddlm}|�|j	�fd	d
��|j
|_|�t
j�|�|jjdd�|�|j�|�|jdt
j�|�t��d
��d}|�|j|j�|�|jdg�|�|j|j
�dS)NrVrWT)�stopasgrouprHrr-r�cr�rr�r�r�rrr��r�z2SubprocessTests.test_stopasgroup.<locals>.<lambda>z7killing test (pid 11) process group with signal SIGTERMrsr])rArH)rr	r#rAr0r.r�r�r�r�r�r�r=r5r>r5r�r�rOrFrLr�r�re�extra_values�
from_stater_rr�r�test_stopasgroup�s$
z SubprocessTests.test_stopasgroupcs�t�}g�g���fdd�}||_t|dd�}|�|�}d|_ddlm}|j|_|�	t	j
�|��|jg�|��t	j
g�|�|jj
dd�dS)	Nc���|���|�dSrr��rA�sig��	killedpid�	killedsigrrr=��
z)SubprocessTests.test_signal.<locals>.killrVrWrHrr-�"sending test (pid 11) sig SIGWINCH)rr=r	r#rAr0r.r�r�r5�SIGWINCHr5r�r��rr?r=r>rLr.rr|r�test_signal�s
zSubprocessTests.test_signalcs�t�}g�g���fdd�}||_t|dd�}|�|�}d|_ddlm}|j|_|�	t	j
�|�|jj
dd�|��g�dS)Ncryrr�rzr|rrr=�rz1SubprocessTests.test_signal_stopped.<locals>.killrVrWrr-z9attempted to send test sig SIGWINCH but it wasn't running)rr=r	r#rAr0r.rPr�r5r�r5r�r�r�rr|r�test_signal_stopped�s
z#SubprocessTests.test_signal_stoppedcs�t�}t|dd�}d|_|�|�}g�ddlm}ddlm}|�|j	�fdd��d	|_
|j|_|�
t
j�|�|jjdd
�|�|jjd�d��|�d|jjdv�|�|j�|�t��d��d}|�|j|j�dS)
NrVrWr]rr-r�cr�rr�r�r�rrr��r�z3SubprocessTests.test_signal_error.<locals>.<lambda>rHr�z%unknown problem sending sig test (11)rc)rr	rdr#r0r.r�r�r�r�rAr�r�r5r�r5r�r�rOrPrDrFr�r�rfr_rr�r�test_signal_error�s,
��z!SubprocessTests.test_signal_errorcsHt�}t|dddd�}|�|�}d|_||jjjd<d|_ddd	�}||_d
dl	m
}d
dlm}|j
|_g�|�|j�fd
d��d|_|�dd�|�|j�|�|jd
�|�|j|�|�|ji�|�|ji�|�|jjd
d�|�|jd�|�t��d��d
}|�|j|j�|�|jdg�|�|j|j
�dS)Nrvrwre�r<)�{r]r�Trr�rrrr-r�cr�rr�r�r�rrr�r�z<SubprocessTests.test_finish_stopping_state.<locals>.<lambda>r]z(stopped: notthere (terminated by SIGHUP)r3�rAr�)rr	r#�
waitstatusr>r?rrFrHr0r.r�r�rVr�r�r�rA�finishrDr5r�rIr�r��
exitstatusr�r�rprvrw�rr?r>rLrHr.r�r`rr�r�test_finish_stopping_state�s:�

z*SubprocessTests.test_finish_stopping_statecsVt�}t|dddd�}|�|�}||jjjd<ddd�}||_dg|j_d	d
lm	}d	dl
m}|j|_
g�|�|j�fdd
��d|_|�dd�|�|j�|�|jd	�|�|j|�|�|ji�|�|ji�|�|jjd	d�|�|jd�|�t��d��d	}|�|j|j�|�|jd�|�|jddg�|�|j|j�dS)Nrvrwrer�r�rrr�r3rr-r�cr�rr�r�r�rrr�*r�zISubprocessTests.test_finish_running_state_exit_expected.<locals>.<lambda>r]�1exited: notthere (terminated by SIGHUP; expected)T��expectedTr�) rr	r#r>r?rrH�	exitcodesr0r.r�r�r�r�r�r�rAr�rDrFr5r�rIr�r�r�r�r��ProcessStateExitedEventr�rvrwr�rr�r�'test_finish_running_state_exit_expectedsB�


��z7SubprocessTests.test_finish_running_state_exit_expectedcs�t�}t|dddd�}|�|�}||jjjd<ddd�}||_dg|j_t��d	|_	d
dl
m}d
dlm
}|j|_g�|�|j�fd
d��d|_|�dd�|�|j�|�|jd
�|�|j|�|�|ji�|�|ji�|�|jjd
d�|�|jjdd�|�|jd�|�t��d��d
}|�|j|j�|�|jd�|�|j dg�|�|j!|j��d}|�|j|j"�|�|jd�|�|j ddg�|�|j!|j#�dS)Nrvrwrer�r�rrr�r3rXrr-r�cr�rr�r�r�rrr�Kr�zPSubprocessTests.test_finish_starting_state_laststart_in_future.<locals>.<lambda>r]��process 'notthere' (123) laststart time is in the future, don't know how long process was running so assuming it did not exit too quicklyr�r�Tr�r�)$rr	r#r>r?rrHr�r:r@r0r.r�r�rr�r�r�rAr�rDrFr5r�rIr�r�r�r�r��ProcessStateRunningEventr�rvrwr�r�r�rr�r�.test_finish_starting_state_laststart_in_future=sP�


��z>SubprocessTests.test_finish_starting_state_laststart_in_futurecsBt�}t|ddddd�}|�|�}||jjjd<ddd�}||_d	g|j_t��|_	d
dl
m}d
dlm
}|j|_g�|�|j�fd
d��d|_|�dd�|�|j�|�|jd
�|�|j|�|�|ji�|�|ji�|�|jjd
d�|�|jd�|�t��d��d
}|�|j|j�|�|j|j�dS)Nrvrwrer
�r<�	startsecsr�rrr�r3rr-r�cr�rr�r�r�rrr�tr�zOSubprocessTests.test_finish_starting_state_exited_too_quickly.<locals>.<lambda>r]z5exited: notthere (terminated by SIGHUP; not expected)) rr	r#r>r?rrHr�r:r@r0r.r�r�rr�r�r�rAr�rDrFr5r�rIr�r�r�r�r�r�rwr�rr�r�-test_finish_starting_state_exited_too_quicklyfs<�



�z=SubprocessTests.test_finish_starting_state_exited_too_quicklycsbt�}t|ddddd�}|�|�}||jjjd<ddd�}||_d	g|j_t��|_	d
dl
m}d
dlm
}|j|_g�|�|j�fd
d��d|_|�dd�|�|j�|�|jd
�|�|j|�|�|ji�|�|ji�|�|jjd
d�|�|jd	�|�t��d��d
}|�|j|j�|�|jd�|�|j ddg�|�|j!|j�dS)Nrvrwrer
r�r�rrr�r3rr-r�cr�rr�r�r�rrr��r�zdSubprocessTests.test_finish_running_state_exited_too_quickly_due_to_clock_rollback.<locals>.<lambda>r]r�Tr�r��"rr	r#r>r?rrHr�r:r@r0r.r�r�r�r�r�r�rAr�rDrFr5r�rIr�r�r�r�r�r�r�rvrwr�rr�r�Btest_finish_running_state_exited_too_quickly_due_to_clock_rollback�sD�



��zRSubprocessTests.test_finish_running_state_exited_too_quickly_due_to_clock_rollbackcsxt�}t|dddd�}|�|�}||jjjd<ddd�}||_dg|j_t��d	|_	d
dl
m}d
dlm
}|j|_g�|�|j�fd
d��d|_|�dd�|�|j�|�|jd
�|�|j|�|�|ji�|�|ji�|�|jjd
d�|�|jjdd�|�|jd�|�t��d��d
}|�|j|j�|�|jd�|�|j ddg�|�|j!|j�dS)Nrvrwrer�r�rrr�r3rXrr-r�cr�rr�r�r�rrr��r�zOSubprocessTests.test_finish_running_state_laststart_in_future.<locals>.<lambda>r]r�r�Tr�r�r�r�rr�r�-test_finish_running_state_laststart_in_future�sJ�


���z=SubprocessTests.test_finish_running_state_laststart_in_futurec	s�ddlm}g�|�|j�fdd��|�|j�fdd��t�}t|dddd	d
�}|�|�}ddlm	}|j
|_t�}||_
|�dd
�|�t��d��\}}|�|j|j�|�|j|j�|�|j|�|�|j
|�|�|j
d�dS)Nrr�cr�rr�r�r�rrr��r�zOSubprocessTests.test_finish_with_current_event_sends_rejected.<locals>.<lambda>cr�rr�r�r�rrr��r�rvrwrer
r�r-r�r]r�)r�r�r�r��EventRejectedEventrr	r#r0r.r�r�r
r`r�r5r�r�r��process)	rr�r?r>rLr.r`r�r�rr�r�-test_finish_with_current_event_sends_rejected�s.�
�z=SubprocessTests.test_finish_with_current_event_sends_rejectedcCs6t�}t|dd�}|�|�}|��|�|jd�dS)NrVrW�rr	r#�set_uidr5r�rKrrr�test_set_uid_no_uid�s

z#SubprocessTests.test_set_uid_no_uidcCsFt�}t|dddd�}|�|�}|��}|�|jd�|�|d�dS)NrVrWr]r�r�)rr?r>rLr�rrr�test_set_uid�s
zSubprocessTests.test_set_uidcCs�t�}t|ddddd�}|�|�}t|ddddd�}|�|�}t|dddd	d�}|�|�}|||g}|��|�||||g�dS)
Nrvrwrer])r<�priority�	notthere1r��	notthere2r�)rr	r#�sortr5)rr?r>rL�	instance1�	instance2r�rrr�test_cmp_bypriority�s&�
�
�

z#SubprocessTests.test_cmp_byprioritycs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}|�|�}d|_|j
|_|��|�|j|j
�|��g�dS)Nrr�cr�rr�r�r�rrr�
r�zYSubprocessTests.test_transition_stopped_to_starting_supervisor_stopping.<locals>.<lambda>�r.�SupervisorStatesr��/bin/process)r�r�r�r�r0r.r�r�SHUTDOWN�moodr	r#r@rPr��
transitionr5�rr�r.r�r?�pconfigr�rr�r�7test_transition_stopped_to_starting_supervisor_stopping
s
zGSubprocessTests.test_transition_stopped_to_starting_supervisor_stoppingcs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}|�|�}d|_|j
|_|��|�|j|j�|�t��d��d}|�|j|j�dS)	Nrr�cr�rr�r�r�rrr�r�zXSubprocessTests.test_transition_stopped_to_starting_supervisor_running.<locals>.<lambda>r�r�r�r])r�r�r�r�r0r.r�rr�r�r	r#r@rPr�r�r5rr�r�r�)rr�r.r�r?r�r�r`rr�r�6test_transition_stopped_to_starting_supervisor_runnings
zFSubprocessTests.test_transition_stopped_to_starting_supervisor_runningcs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}ddlm}||_
|�|�}d	|_d
|_|j|_|��|�|j|j�|�|j�|��g�dS)Nrr�cr�rr�r�r�rrr�0r�zXSubprocessTests.test_transition_exited_to_starting_supervisor_stopping.<locals>.<lambda>r�r�r���RestartUnconditionallyr]T)r�r�r�r�r0r.r�rr�r�r	�supervisor.datatypesr��autorestartr#r@r\�EXITEDr�r�r5rO)rr�r.r�r?r�r�r�rr�r�6test_transition_exited_to_starting_supervisor_stopping-s"
zFSubprocessTests.test_transition_exited_to_starting_supervisor_stoppingcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}ddlm	}||_
|�|�}d	|_|j
|_|��|�|j|j�|�t��d	��d}|�|j|j�dS)
Nrr�cr�rr�r�r�rrr�Er�z^SubprocessTests.test_transition_exited_to_starting_uncond_supervisor_running.<locals>.<lambda>r-r�r�r�r])r�r�r�r�r0r.rr	r�r�r�r#r@r�r�r�r5rr�r�r�)rr�r.r?r�r�r�r`rr�r�<test_transition_exited_to_starting_uncond_supervisor_runningBs 
zLSubprocessTests.test_transition_exited_to_starting_uncond_supervisor_runningcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}ddlm	}||_
|�|�}d	|_|j
|_d
|_|��|�|j|j�|�t��d	��d}|�|j|j�dS)Nrr�cr�rr�r�r�rrr�Xr�z^SubprocessTests.test_transition_exited_to_starting_condit_supervisor_running.<locals>.<lambda>r-r�r���RestartWhenExitUnexpectedr]�bogus)r�r�r�r�r0r.rr	r�r�r�r#r@r�r�r�r�r5rr�r�r�)rr�r.r?r�r�r�r`rr�r�<test_transition_exited_to_starting_condit_supervisor_runningUs"
zLSubprocessTests.test_transition_exited_to_starting_condit_supervisor_runningcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}ddlm	}||_
|�|�}d	|_|j
|_d|_|��|�|j|j
�|��g�dS)
Nrr�cr�rr�r�r�rrr�lr�zbSubprocessTests.test_transition_exited_to_starting_condit_fls_supervisor_running.<locals>.<lambda>r-r�r�r�r])r�r�r�r�r0r.rr	r�r�r�r#r@r�r�r�r�r5)rr�r.r?r�r�r�rr�r�@test_transition_exited_to_starting_condit_fls_supervisor_runningis
zPSubprocessTests.test_transition_exited_to_starting_condit_fls_supervisor_runningcs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}|�|�}d|_d|_
d|_|j|_|��|�|j|j�|��g�dS)	Nrr�cr�rr�r�r�rrr�~r�zYSubprocessTests.test_transition_backoff_to_starting_supervisor_stopping.<locals>.<lambda>r�r�r�r])r�r�r�r�r0r.r�rr�r�r	r#r@rCrGr�r�r�r5r�rr�r�7test_transition_backoff_to_starting_supervisor_stopping{�
zGSubprocessTests.test_transition_backoff_to_starting_supervisor_stoppingcs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}|�|�}d|_d|_
d|_|j|_|��|�|j|j�|�t��d�|��dj|j�dS)	Nrr�cr�rr�r�r�rrr��r�zXSubprocessTests.test_transition_backoff_to_starting_supervisor_running.<locals>.<lambda>r�r�r�r])r�r�r�r�r0r.r�rr�r�r	r#r@rCrGr�r�r�r5rr�r�r�r�rr�r�6test_transition_backoff_to_starting_supervisor_running�s 
zFSubprocessTests.test_transition_backoff_to_starting_supervisor_runningcs�ddlm}g�|�|j�fdd��ddlm}m}t�}|j|_	t
|ddd�}|�|�}d|_t
|_d|_|j|_|��|�|j|j�|��g�dS)	Nrr�cr�rr�r�r�rrr��r�z_SubprocessTests.test_transition_backoff_to_starting_supervisor_running_notyet.<locals>.<lambda>r�r�r�r])r�r�r�r�r0r.r�rr�r�r	r#r@rrCrGr�r�r�r5r�rr�r�=test_transition_backoff_to_starting_supervisor_running_notyet�r�zMSubprocessTests.test_transition_backoff_to_starting_supervisor_running_notyetcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}|�|�}d|_	d|_
d	|_d|_d|_
d
|_d|_|j|_|��|�|j	d�|�|j
d�|�|j�|�|jjdd�|�t��d��d}|�|j|j�dS)
Nrr�cr�rr�r�r�rrr��r�zESubprocessTests.test_transition_starting_to_running.<locals>.<lambda>r-r�r�r]F�abc�defz_success: process entered RUNNING state, process has stayed up for > than 10 seconds (startsecs))r�r�r�r�r0r.rr	r#rGrCr\r@rA�
stdout_buffer�
stderr_bufferrr�r�r5rDr�r�r�r�r��rr�r.r?r�r�r`rr�r�#test_transition_starting_to_running�s2
�z3SubprocessTests.test_transition_starting_to_runningc	sRddlm}g�|�|j�fdd��ddlm}t��d}t�}d}t|ddd	|d
�}|�	|�}d|_
d|_d|_||_
d|_d
|_d|_|j|_|��|�|j|j�|�|j
|k�t�|d�|��|�|j
d�|�|jd�|�|j�|�|j|j�|�|jjdd�|��|�t��d��d}|�|j|j�dS)Nrr�cr�rr�r�r�rrr��r�zYSubprocessTests.test_transition_starting_to_running_laststart_in_future.<locals>.<lambda>r-rXr�r�r�)r�r]Fr�r�z_success: process entered RUNNING state, process has stayed up for > than {} seconds (startsecs))r�r�r�r�r0r.r:rr	r#rGrCr\r@rAr�r�rr�r�r5rOr;rDr�r�r��formatr�r�r�)	rr�r.rYr?�test_startsecsr�r�r`rr�r�7test_transition_starting_to_running_laststart_in_future�sF
�
�zGSubprocessTests.test_transition_starting_to_running_laststart_in_futurecs�ddlm}g�|�|j�fdd��ddlm}t��d}t�}t|ddd�}|�	|�}d	|_
||_d|_|j
|_|��|�|j|j
�|�|j|k�|��|�|j|j�|�t��d	�|��dj|j�dS)
Nrr�cr�rr�r�r�rrr�	r�zUSubprocessTests.test_transition_backoff_to_starting_delay_in_future.<locals>.<lambda>r-rXr�r�r])r�r�r�r�r0r.r:rr	r#r@rCrGr�r�r�r5rOrr�r�r�)rr�r.rYr?r�r�rr�r�3test_transition_backoff_to_starting_delay_in_futures&
zCSubprocessTests.test_transition_backoff_to_starting_delay_in_futurecs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}|�|�}d|_	d	|_
d|_d
|_d|_
d|_|j|_|��|�|j
d�|�|jd�|�|j�|�|jjdd
�|�t��d��d}|�|j|j�dS)Nrr�cr�rr�r�r�rrr�+r�zBSubprocessTests.test_transition_backoff_to_fatal.<locals>.<lambda>r-r�r�r]i'Fr�r�zHgave up: process entered FATAL state, too many start retries too quickly)r�r�r�r�r0r.rr	r#r@rGrCr\r�r�r�r�r�r5rOr�r�r�r�r^r�rr�r� test_transition_backoff_to_fatal(s0
�z0SubprocessTests.test_transition_backoff_to_fatalcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}|�|�}t	|_
|j|_|�
�|�|j|j�|��g�dS)Nrr�cr�rr�r�r�rrr�Jr�zISubprocessTests.test_transition_stops_unkillable_notyet.<locals>.<lambda>r-r�r�)r�r�r�r�r0r.rr	r#rrCrVr�r�r5�rr�r.r?r�r�rr�r�'test_transition_stops_unkillable_notyetGs
z7SubprocessTests.test_transition_stops_unkillable_notyetcs�ddlm}g�|�|j�fdd��ddlm}t�}t|ddd�}|�|�}d|_	d|_
d	|_|j|_
|��|�|j�|�|j	d�|�|j
|j�|�|jjdd
�|�|jdtj�|��g�dS)Nrr�cr�rr�r�r�rrr�Zr�zBSubprocessTests.test_transition_stops_unkillable.<locals>.<lambda>r-r�r�r]Fz"killing 'process' (1) with SIGKILL)r�r�r�r�r0r.rr	r#rCrArFrVr�r�rOrAr5r�r�rLr5rmr�rr�r� test_transition_stops_unkillableWs(
�z0SubprocessTests.test_transition_stops_unkillablecCs8t�}t|dd�}|�|�}d|_|�|�d�d�dS)NrVrWr
F)rr	r#r�r5�change_staterKrrr�2test_change_state_doesnt_notify_if_no_state_changens

zBSubprocessTests.test_change_state_doesnt_notify_if_no_state_changecCs\ddlm}t�}t|dd�}|�|�}d|_|�|j�|�|j	d�|�
|jdk�dS)Nrr-rVrWr
r])r0r.rr	r#r�r�r�r5rGrOrC)rr.r?r>rLrrr�(test_change_state_sets_backoff_and_delayus
z8SubprocessTests.test_change_state_sets_backoff_and_delayN)[rrrrr#r+r8rMrSr`rdrirorsrur{r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r
rrrr!r$r*r,rGrOrRrTrWrZrarbrgrirkrorqrtrxr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrs�





+"	 )"!% 4"rc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Ze�
edeejd��dd��Ze�
edeejd��dd��Ze�
ededd��dd��ZdS)�FastCGISubprocessTestscCr)Nr)�FastCGISubprocess)rr�)rr�rrrr�rz&FastCGISubprocessTests._getTargetClasscOrrrr rrrr#�r$zFastCGISubprocessTests._makeOnecCr%r&r(r*rrrr+�r,zFastCGISubprocessTests.tearDowncCs8t�}d|_t|dddd�}|�|�}|�t|j�dS�Nrr�r�r]r�)rr�r	r#rm�NotImplementedErrorr�rKrrr�
test_no_group�s

z$FastCGISubprocessTests.test_no_groupcCsFt�}d|_t|dddd�}|�|�}tt|��|_|�t|j	�dSr�)
rr�r	r#rrr	rmr�r�rKrrr�test_no_socket_manager�s
z-FastCGISubprocessTests.test_no_socket_managercCs�t�}d|_t|dddd�}|�|�}td�}t|ddd|�}t|�|_|��}|�	|d�|�	t
|j�d	�|�	|jdd�|�	|j|jd
d�|�	|j|jdd�|�	t
|j
�|jd	�dS)
Nrr�r�r]r�r�whatever��r��child_stdout�child_stderrr�)rr�r	r#rrrr	r�r5r�r�rHr�r��rr?r>rL�sock_config�gconfigr�rrr�test_prepare_child_fds�s 

�
z-FastCGISubprocessTests.test_prepare_child_fdscCs�t�}d|_t|dddd�}d|_|�|�}td�}t|dd	d|�}t|�|_|�	�}|�
|d�|�
t|j�d
�|�
|jdd�|�
t|j
�|jd�dS)Nrr�r�r]r�T�
r�r�r�r�)rr�r	rr#rrrr	r�r5r�r�r�r�r�rrr�(test_prepare_child_fds_stderr_redirected�s

�
z?FastCGISubprocessTests.test_prepare_child_fds_stderr_redirectedcCsnt�}t|dddd�}|�|�}td�}t|ddd|�}t|�|_|�|jdu�|�	�|�
|jdu�dS)Nr�r�r]r�rr�r�)rr	r#rrrr	rO�	fcgi_sock�before_spawnrD)rr?r>rLr�r�rrr�!test_before_spawn_gets_socket_ref�s

�
z8FastCGISubprocessTests.test_before_spawn_gets_socket_refcCsBt�}t|dddd�}|�|�}d|_|��|�|jdu�dS)Nr�r�r]r��hello)rr	r#r��after_finishrOrKrrr�$test_after_finish_removes_socket_ref�s
z;FastCGISubprocessTests.test_after_finish_removes_socket_refr�)�return_valuecCs�t�}t|dddd�}|�|�}t�|_|�tjtj�}|�	tj
|d�|�	d|jjd�tj}|�	d|jd�|j
dd}|j
dd	}|�	tj|d
�|�	tj|d�dS)Nr�r�r]r�z3FastCGISubprocess.finish() did not pass thru resultz0FastCGISubprocess.after_finish() not called oncez#Subprocess.finish() not called oncerr�z*Subprocess.finish() pid arg was not passedz*Subprocess.finish() sts arg was not passed)rr	r#rr�r�rrArFr5�
finish_result�
call_countr�	call_args)rr?r>rLr��finish_mock�pid_arg�sts_argrrr�test_finish_override�s.

��
�
�
�z+FastCGISubprocessTests.test_finish_overrider�cCslt�}t|dddd�}|�|�}t�|_|��}|�tj|d�|�d|jj	d�t
j}|�d|j	d�dS)Nr�r�r]r�z2FastCGISubprocess.spawn() did not pass thru result�0FastCGISubprocess.before_spawn() not called oncez"Subprocess.spawn() not called once)rr	r#rr�r�r5r�ppidr�r)rr?r>rLr��
spawn_mockrrr�test_spawn_override_success�s

��
�z2FastCGISubprocessTests.test_spawn_override_successNcCsjt�}t|dddd�}|�|�}t�|_d|_|��}|�d|d�|�d|jjd�|�d|jd�dS)	Nr�r�r]r�znuke me on errorz2FastCGISubprocess.spawn() did return None on errorr�z:FastCGISubprocess.spawn() did not remove sock ref on error)	rr	r#rr�r�r�r5r�r�rrr�test_spawn_error�s
��
�z'FastCGISubprocessTests.test_spawn_error)rrrrr#r+r�r�r�r�r�r�r�objectrrrr�r�r�r�r�rrrrr�s 	

r�c@sTeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)�ProcessGroupBaseTestscCr)Nr)�ProcessGroupBase)rr�)rr�rrrrrz%ProcessGroupBaseTests._getTargetClasscOrrr)rrzr"rrrr#
r$zProcessGroupBaseTests._makeOnecCsjt�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_|�	�}|�
||g�dS�Nrr-�process1�
/bin/process1�r���pconfigs)rr0r.r	r
rVrr#�	processes�get_unstopped_processesr5)rr?r.�pconfig1r�r�r	�	unstoppedrrr�test_get_unstopped_processes
�

z2ProcessGroupBaseTests.test_get_unstopped_processescCs\t�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_|�	�dSr�)
rr0r.r	r
rVrr#r�
before_remove�rr?r.rr�r�r	rrr�test_before_removes

z(ProcessGroupBaseTests.test_before_removec
Csddlm}t�}t|ddd�}t||jd�}t|ddd�}t||jd�}t|ddd	�}t||jd�}t|d
d
d�}	t|	|jd�}
d|
_	d
|
_
t|||||	gd�}|�|�}||||
d�|_
|��|�|jd�|�|jd�|�|jd�|�|
jd�|�|
j|j�dS)Nrr-r�r�r�process2�
/bin/process2�process3z
/bin/process3�process4z
/bin/process4��r
r)r�rrrFT)r0r.rr	r
rPr�rr�rCrGrr#r�stop_allr5�stop_calledr�r])
rr.r?rr��pconfig2r�pconfig3r�pconfig4rr�r	rrr�
test_stop_all"s4
�
�z#ProcessGroupBaseTests.test_stop_allc
Cs�t�}ddlm}t|ddd�}t||jd�}ddi|_t|ddd�}t||jd�}d	di|_t|||gd
�}|�|�}||d�|_	|�
�}	|�|	ddd��dS)
Nrr-r�r�rrrr
rr)r�r)rr)rr0r.r	r
rVrIrr#r�get_dispatchersr5)
rr?r.rr�rrr�r	r�rrr�test_get_dispatchers@s


z*ProcessGroupBaseTests.test_get_dispatcherscC�jt�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_|�	�|�
|jd�dS�Nrr-r�r�rrT)rr0r.r	r
rVrr#rr^r5r_r
rrrr`Orz%ProcessGroupBaseTests.test_reopenlogscCrr)rr0r.r	r
rVrr#rrbr5�logsremovedr
rrrrdZrz%ProcessGroupBaseTests.test_removelogsc	Cs�t�}t|�}|�|�}t|�}|�|�}t|�}|�|�}d|j_d|j_d|j_||g}|��|�|||g�|�||�|�||�dS)Nrr])rrr#r>r�r�r5rA)	rr?�gconfig1�group1�gconfig2�group2�config3�group3r�rrr�test_ordering_and_comparisones


z2ProcessGroupBaseTests.test_ordering_and_comparisonN)rrrrr#rrrrr`rdr"rrrrr�s
r�c@�$eZdZdd�Zdd�Zdd�ZdS)�ProcessGroupTestscCr)Nr)�ProcessGroup)rr%)rr%rrrr|rz!ProcessGroupTests._getTargetClasscCsDt�}t|�}|�|�}t|�}|�d|v�|�|�d�|�dS)Nzsupervisor.process.ProcessGroup�named whatever>�rrr#rNrOrQ)rr?r�r	rRrrrrS�s
zProcessGroupTests.test_reprcCrr)rr0r.r	r
rVrr#rr�r5�transitionedr
rrr�test_transition�rz!ProcessGroupTests.test_transitionN)rrrrrSr)rrrrr${sr$c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�FastCGIProcessGroupTestscCr)Nr)�FastCGIProcessGroup)rr+)rr+rrrr�rz(FastCGIProcessGroupTests._getTargetClasscKs|��}||fi|��Srr)rr>�kwargs�clsrrrr#�sz!FastCGIProcessGroupTests._makeOnecCs6t�}t|�}d|_Gdd�dt�}|j||d�dS)Nc@seZdZdd�Zdd�ZdS)zVFastCGIProcessGroupTests.test___init__without_socket_error.<locals>.DummySocketManagercS�dSrr�rr>r�rrr�__init__��z_FastCGIProcessGroupTests.test___init__without_socket_error.<locals>.DummySocketManager.__init__cSr.rr�rrrr�
get_socket�r1zaFastCGIProcessGroupTests.test___init__without_socket_error.<locals>.DummySocketManager.get_socketN)rrrr0r3rrrr�DummySocketManager�sr4��
socketManager)rr�
socket_configr�r#�rr?r�r4rrr�!test___init__without_socket_error�s
z:FastCGIProcessGroupTests.test___init__without_socket_errorcCs<t�}t|�}d|_Gdd�dt�}|jt|j||d�dS)Nc@r#)zSFastCGIProcessGroupTests.test___init__with_socket_error.<locals>.DummySocketManagercSr.rrr/rrrr0�r1z\FastCGIProcessGroupTests.test___init__with_socket_error.<locals>.DummySocketManager.__init__cSstd��)Nr)�KeyErrorr2rrrr3�sz^FastCGIProcessGroupTests.test___init__with_socket_error.<locals>.DummySocketManager.get_socketcSsdS)Nr>rr2rrrr>�szZFastCGIProcessGroupTests.test___init__with_socket_error.<locals>.DummySocketManager.configN)rrrr0r3r>rrrrr4�sr4r5)rrr7r�rm�
ValueErrorr#r8rrr�test___init__with_socket_error�s
�z7FastCGIProcessGroupTests.test___init__with_socket_errorN)rrrrr#r9r<rrrrr*�s

r*c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�EventListenerPoolTestscCr%r&r(r*rrr�setUp�r,zEventListenerPoolTests.setUpcCr%r&r(r*rrrr+�r,zEventListenerPoolTests.tearDowncCr)Nr)�EventListenerPool)rr?)rr?rrrr�rz&EventListenerPoolTests._getTargetClasscCs�t�}t|�}Gdd�d�}|f|_|�|�}ddlm}|�t|j�d�|�|jd||j	f�|�|jd|j
|jf�|�|jd�dS)Nc@�eZdZdS)z3EventListenerPoolTests.test_ctor.<locals>.EventTypeN�rrrrrrr�	EventType��rBrr�r�r]r3)
rr�pool_eventsr#r�r�r5r��	callbacks�_acceptEventr��handle_rejected�serial�rr?r�rB�poolr�rrrrM�s
�
�z EventListenerPoolTests.test_ctorcCsjt�}t|�}Gdd�d�}|f|_|�|�}ddlm}|�t|j�d�|�	�|�t|j�d�dS)Nc@r@)zUEventListenerPoolTests.test_before_remove_unsubscribes_from_events.<locals>.EventTypeNrArrrrrB�rCrBrr�r�)
rrrDr#r�r�r5r�rEr	rIrrr�+test_before_remove_unsubscribes_from_events�s
zBEventListenerPoolTests.test_before_remove_unsubscribes_from_eventsc	Cs�t�}d|_t|�}d|_|�|�}ddlm}|�|jj	ddd�}|�
dd	�\}}|�
�}|�|dd
�|�|d	d�|�|dd
�|�|dd�|�|dd�|�|dd�|�|dd�|�|d�dS)N�thesupervisorname�thepoolnamerr��P�zpayload
�
r]zver:3.0zserver:thesupervisornamer�z	serial:80r�zpool:thepoolnamerz
poolserial:20rz&eventname:PROCESS_COMMUNICATION_STDOUTr�zlen:8)r�
identifierrr�r#r�r��_eventEnvelope�
EventTypes�PROCESS_COMMUNICATION_STDOUTr�r5)	rr?r�rJr�r��header�payload�headersrrr�test__eventEnvelope�s&
�z*EventListenerPoolTests.test__eventEnvelopecs�t�}t|�}t|ddd�}t|��t||gd�}|�|�}d�i|_ddg|_Gdd�d��G��fdd�d�}|�}d|_|�|�|�	|j|j
ddg�dS)	Nr�r�rc@r�)zLEventListenerPoolTests.test_handle_rejected_no_overflow.<locals>.DummyEvent1r�N)rrrrHrrrr�DummyEvent1�rrYcseZdZ�Z��ZdS)zLEventListenerPoolTests.test_handle_rejected_no_overflow.<locals>.DummyEvent2N)rrrr�r`r�rYr�rr�DummyEvent2�s
r[r])rrr	r
r#r�event_bufferrHrGr5r`)rr?r�rrJr[�
dummyeventrrZr� test_handle_rejected_no_overflow�s



z7EventListenerPoolTests.test_handle_rejected_no_overflowcs�t�}t|�}t|ddd�}t|��t||gd�}d|_|�|�}d�i|_Gdd�d��G��fdd�d�}�d	�}�d
�}�d�}|d�}	|||g|_|�|	�d
d�|jD�}
|�	|
gd��|�	|j
jjj
dd�dS)Nr�r�rr�c@�eZdZdd�ZdS)zWEventListenerPoolTests.test_handle_rejected_event_buffer_overflowed.<locals>.DummyEventcSs
||_dSr�rH�rrHrrrr0r�z`EventListenerPoolTests.test_handle_rejected_event_buffer_overflowed.<locals>.DummyEvent.__init__N�rrrr0rrrrr

�r
cseZdZ��fdd�ZdS)z_EventListenerPoolTests.test_handle_rejected_event_buffer_overflowed.<locals>.DummyRejectedEventcs�|_�|�|_dSr)r�r`ra�r
r�rrr0szhEventListenerPoolTests.test_handle_rejected_event_buffer_overflowed.<locals>.DummyRejectedEvent.__init__Nrbrrdrr�DummyRejectedEventsrer�b�c�rejectedcSsg|]}|j�qSrr`)�.0r�rrr�
<listcomp>szWEventListenerPoolTests.test_handle_rejected_event_buffer_overflowed.<locals>.<listcomp>)rhrfrgrz9pool whatever event buffer overflowed, discarding event a)rrr	r
�buffer_sizer#rr\rGr5r>r?r�r�)rr?r�rrJre�event_a�event_b�event_c�	rej_event�serialsrrdr�,test_handle_rejected_event_buffer_overfloweds*


�zCEventListenerPoolTests.test_handle_rejected_event_buffer_overflowedcCs�t�}t|�}t|ddd�}ddlm}t||gd�}|�|�}|jd}tj|_	|j
|_t�}|�
|�|��|�|j|j
�|�|j|g�|�|jjdd�|�|jjdd�dS)	Nr�r�r��EventListenerStatesrzUepipe occurred while sending event abc to listener process1, listener state unchangedr]z<rebuffering event abc for pool whatever (buf size=0, max=10))rrr	r0rsr#rr�r(�write_error�READY�listener_stater
rF�dispatchr5r\r�r�)rr?r�rrsrJr�r`rrr�test_dispatch_pipe_error s(


��z/EventListenerPoolTests.test_dispatch_pipe_errorc	Cs�ddlm}t�}t|�}t|ddd�}t||gd�}|�|�}|jd}ddlm}|j	|_
td�}|�|�|�
|j|j�|�
|jd|j�dS)Nr)�GlobalSerialr�r�rrrr�)rryrrr	r#rr0rsrurvr
rFr5rH�pool_serials)	rryr?r�rrJr�rsr`rrr�1test__acceptEvent_attaches_pool_serial_and_serial5s


zHEventListenerPoolTests.test__acceptEvent_attaches_pool_serial_and_serialcCsBt�}t|�}|�|�}t|�}|�d|v�|�|�d��dS)Nz$supervisor.process.EventListenerPoolr&r')rr?r�rJrRrrrrSDs
z EventListenerPoolTests.test_reprc	Cs�t�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_t	�}d|_
ddlm}|j|_
|�|�|��|�|jd	�|�|j|g�dS)
Nrr-r�r�rrrrrT)rr0r.r	r
rrr#rr
rHrs�BUSYrvrFr�r5r(r\�	rr?r.rr�r�rJr`rsrrr�test_transition_nobody_readyLs


z3EventListenerPoolTests.test_transition_nobody_readyc	Cs�t�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_t	�}ddlm
}d|_|j|_
|�|�|��|�|jd	�|�|j|g�|�|jd
�|�|j
|j�dS)Nrr-r�r�rrrrr]T�)rr0r.r	r
rrr#rr
rsrHrurvrFr�r5r(r\�stdin_bufferr}rrr�&test_transition_event_proc_not_running]s"


z=EventListenerPoolTests.test_transition_event_proc_not_runningcs�t�}ddlm}t|ddd�}t||jd�}t||gd��|���}d|i|_t	�}ddlm
}|j|_G�fdd	�d	�}||_
|�|�|��|�|jd
�|�|jg�|j�dd�\}	}
|�|
d
|
�|�|j|j�|�|j|�dS)Nrr-r�r�rrrrc�eZdZ�ZdS)zMEventListenerPoolTests.test_transition_event_proc_running.<locals>.DummyGroupN�rrrr>r�r�rr�
DummyGroup{rr�T�
r]�dummy event)rr0r.r	r
r�rr#rr
rsrurvr	rFr�r5r(r\r�r�r|r`�rr?r.rr�rJr`rsr�rUrVrr�r�"test_transition_event_proc_runningps(


z9EventListenerPoolTests.test_transition_event_proc_runningc	s�t�}ddlm}t|ddd�}t||jd�}t||gd��|���}d|_t	�	�|_
d|i|_t�}ddlm
}|j|_G�fd	d
�d
�}||_|�|�|��|�|jd�|�|j|g�dS)Nrr-r�r�rrrrrcr�)zkEventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_notyet.<locals>.DummyGroupNr�rr�rrr��rr�T)rr0r.r	r
r�rr#�dispatch_throttler:�
last_dispatchrr
rsrurvr	rFr�r5r(r\)	rr?r.rr�rJr`rsr�rr�r�@test_transition_event_proc_running_with_dispatch_throttle_notyet�s$



zWEventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_notyetcst�}ddlm}t|ddd�}t||jd�}t||gd��|���}d|_t	�	�d|_
d|i|_t�}dd	lm
}|j|_G�fd
d�d�}||_|�|�|��|�|jd�|�|jg�|j�d
d�\}	}
|�|
d|
�|�|j|j�|�|j|�dS)Nrr-r�r�rrrrrrcr�)zjEventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_ready.<locals>.DummyGroupNr�rr�rrr��rr�Tr�r]r�)rr0r.r	r
r�rr#r�r:r�rr
rsrurvr	rFr�r5r(r\r�r�r|r`r�rr�r�?test_transition_event_proc_running_with_dispatch_throttle_ready�s,


zVEventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_readyc
s�t��d}t�}ddlm}t|ddd�}t||jd�}t||gd��|���}d|_	||_
d|i|_t�}dd	lm
}|j|_G�fd
d�d�}	|	|_|�|�|��|�|jd�|�|j|g�|�|j
|k�dS)
NrXrr-r�r�rrrrrcr�)z|EventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_future.<locals>.DummyGroupNr�rr�rrr��rr�T)r:rr0r.r	r
r�rr#r�r�rr
rsrurvr	rFr�r5r(r\rO)
rrYr?r.rr�rJr`rsr�rr�r�Qtest_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_future�s(


zhEventListenerPoolTests.test_transition_event_proc_running_with_dispatch_throttle_last_dispatch_in_futurecCsvt�}ddlm}t|ddd�}t||jd�}t||gd�}|�|�}d|i|_t	�}|�
|�|�|�|�d�dS)Nrr-r�r�rrF)
rr0r.r	r
rPrr#rr
rFr5�_dispatchEvent)rr?r.rr�r�rJr`rrr�test__dispatchEvent_notready�s


z3EventListenerPoolTests.test__dispatchEvent_notreadyc
s�t�}ddlm}t|ddd�}t||jd�}dd�}||_t||gd��|���}d|i|_	t
�}dd	lm}|j|_
G�fd
d�d�}	|	|_|�|�|�t|j|�dS)Nrr-r�r�rcSr�r)rr�r�r�rrr�raise_epipe�r�zcEventListenerPoolTests.test__dispatchEvent_proc_write_raises_non_EPIPE_OSError.<locals>.raise_epiperrrcr�)zbEventListenerPoolTests.test__dispatchEvent_proc_write_raises_non_EPIPE_OSError.<locals>.DummyGroupNr�rr�rrr��rr�)rr0r.r	r
r�rrr#rr
rsrurvr	rFrmrr�)
rr?r.rr�r�rJr`rsr�rr�r�7test__dispatchEvent_proc_write_raises_non_EPIPE_OSError�s 


zNEventListenerPoolTests.test__dispatchEvent_proc_write_raises_non_EPIPE_OSErrorN)rrrr>r+rrMrKrXr^rqrxr{rSr~r�r�r�r�r�r�r�rrrrr=�s(r=c@r#)�test_new_serialcCsddlm}||�S)Nr)�
new_serial)rr�)r�instr�rrr�_callFUT�sztest_new_serial._callFUTcsNddlm�G�fdd�dt�}|�}|�|�}|�|jd�|�|d�dS)NrrcseZdZ�fdd�ZdS)z8test_new_serial.test_inst_serial_is_maxint.<locals>.Instcs
�|_dSrr`r2rrrr0�r�zAtest_new_serial.test_inst_serial_is_maxint.<locals>.Inst.__init__Nrbrrrr�Inst�sr�)�supervisor.compatrr�r�r5rH�rr�r�r�rrr�test_inst_serial_is_maxint�s
z*test_new_serial.test_inst_serial_is_maxintcCs>Gdd�dt�}|�}|�|�}|�|jd�|�|d�dS)Nc@r_)z<test_new_serial.test_inst_serial_is_not_maxint.<locals>.InstcSs
d|_dS)Nr]r`r2rrrr0	r�zEtest_new_serial.test_inst_serial_is_not_maxint.<locals>.Inst.__init__Nrbrrrrr��rcr�r�)r�r�r5rHr�rrr�test_inst_serial_is_not_maxint�s

z.test_new_serial.test_inst_serial_is_not_maxintN)rrrr�r�r�rrrrr��s
r�)#r�r�r5r�r:�unittestr�rrr4rrrrr	r
rrr
rrrrrr�supervisor.optionsr�TestCaserr�r�r$r*r=r�rrrr�<module>sVqv"<
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY