Your IP : 216.73.216.14


Current Path : /lib/python3.9/test/libregrtest/__pycache__/
Upload File :
Current File : //lib/python3.9/test/libregrtest/__pycache__/setup.cpython-39.pyc

a

ؒd��@s�ddlZddlZddlZddlZddlZddlZddlmZzddlZWne	y^dZYn0ddl
mZdd�Zdd�Z
dd	�ZdS)
�N)�support)�setup_unraisable_hookc	Csztj��}Wnttfy(d}YnZ0tjd|d�g}ttd�rR|�	tj
�ttd�rh|�	tj�|D]}tj|d|d�qlt
�t�t�tj�|jr�tj�dtj�|j��tj��D]P}t|d�r�t|j�D]\}}tj�|�|j|<q�t|dd�r�tj�|j�|_q�|j�r$d	tj_ |j!du�r<t�"|j!�|j#du�rTt$�%|j#�t�&|j'�oh|j'd
k�|j(t_(ttd��r�dd
�}t�)|�t*�|j+du�rt,tj-|j+d�t_-t,tj.|j+d�t_.t/tj0|j+�t_0t/tj1|j+�t_1t/tj-|j+�t_-t/tj.|j+�t_.dS)NT)Zall_threads�file�SIGALRM�SIGUSR1)�chainrr�__path__�__file__F��addaudithookcSsdS�N�)�name�argsr
r
�,/usr/lib/python3.9/test/libregrtest/setup.py�_test_audit_hookOsz%setup_tests.<locals>._test_audit_hook�(�)2�sys�
__stderr__�fileno�
ValueError�AttributeError�faulthandlerZenable�hasattr�signal�appendrr�register�_adjust_resource_limits�replace_stdoutrZrecord_original_stdout�stdoutZtestdir�path�insert�os�abspath�modules�values�	enumerater�getattrr	Z
huntrleaks�unittestZ
BaseTestSuiteZ_cleanupZmemlimitZset_memlimitZ	threshold�gcZ
set_thresholdZsuppress_msvcrt_asserts�verboseZ
use_resourcesrrZtimeout�maxZ
SHORT_TIMEOUTZLONG_TIMEOUT�minZLOOPBACK_TIMEOUTZINTERNET_TIMEOUT)�nsZ	stderr_fdZsignalsZsignum�module�indexr!rr
r
r�setup_testssT




r1csZtj�z���}Wnty&YdS0t|d�jdddd�t_�fdd�}t�|�dS)	z�Set stdout encoder error handler to backslashreplace (as stderr error
    handler) to avoid UnicodeEncodeError when printing a tracebackN�w�backslashreplaceF�
)�encoding�errors�closefd�newlinecstj���t_dSr)rr �closer
�r r
r�restore_stdoutus
z&replace_stdout.<locals>.restore_stdout)rr rr�openr5�atexitr)�fdr;r
r:rras�rcCs�zddl}ddlm}m}Wnty0YdS0|�|�\}}d}||kr�||kr�t||�}z(|�|||f�td|�d|���WnDtt	fy�}z(td|�d|�d	|�d
��WYd}~n
d}~00dS)z5Adjust the system resource limits (ulimit) if needed.rN)�
RLIMIT_NOFILE�
RLIM_INFINITYizRaised RLIMIT_NOFILE: z -> z#Unable to raise RLIMIT_NOFILE from z to z: �.)
�resourcer?r@�ImportErrorZ	getrlimitr-Z	setrlimit�printr�OSError)rBr?r@Zfd_limitZmax_fdsZdesired_fdsZnew_fd_limit�errr
r
rr{s$

��r)r=rr#rrr)�testrr*rCZtest.libregrtest.utilsrr1rrr
r
r
r�<module>s
Q