a
    ܌xdr                     @   s$  d dl Z d dlZd dlZd dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
 d dlmZ d dlmZ ee  Zee  Ze
ddd	d
ZeddddZeddddZedddZeedddZejdddeed dddZejddddddZejddddddZdS )     N)	Generator)TextIO)Config)Parser)Item)StashKey)parserreturnc                 C   s   d}| j d|dd d S )NzUDump the traceback of all threads if a test takes more than TIMEOUT seconds to finishfaulthandler_timeout        )default)Zaddini)r   help r   L/var/www/html/Ranjet/env/lib/python3.9/site-packages/_pytest/faulthandler.pypytest_addoption   s    r   )configr	   c                 C   sH   dd l }tt }t|d| jt< | | jt< |j	| jt d d S )Nr   wfile)
faulthandlerosdupget_stderr_filenoopenstashfault_handler_stderr_key
is_enabled$fault_handler_originally_enabled_keyenable)r   r   Zstderr_fd_copyr   r   r   pytest_configure   s
    r   c                 C   sP   dd l }|  t| jv r0| jt   | jt= | jtdrL|jt d d S )Nr   Fr   )	r   disabler   r   closegetr   r   r   )r   r   r   r   r   pytest_unconfigure#   s    
r#   )r	   c               	   C   sF   zt j } | dkrt | W S  ttjfy@   t j  Y S 0 d S )N)sysstderrfilenoAttributeErrorioUnsupportedOperation
__stderr__)r'   r   r   r   r   0   s    
r   c                 C   s   t | dpdS )Nr
   r   )floatZgetini)r   r   r   r   get_timeout_config_value?   s    r-   T)ZhookwrapperZtrylast)NNN)itemr	   c                 c   sf   t | j}| jjt }|dkr\|d ur\dd l}|j||d zd V  W |  qb|  0 nd V  d S )Nr   r   )r-   r   r   r   r   Zdump_traceback_latercancel_dump_traceback_later)r.   timeoutr&   r   r   r   r   pytest_runtest_protocolC   s    
r1   )Ztryfirstc                  C   s   ddl } |   dS )z@Cancel any traceback dumping due to timeout before entering pdb.r   Nr   r/   r   r   r   r   pytest_enter_pdbS   s    r4   c                  C   s   ddl } |   dS )zNCancel any traceback dumping due to an interactive exception being
    raised.r   Nr2   r3   r   r   r   pytest_exception_interact[   s    r5   )r)   r   r%   typingr   r   ZpytestZ_pytest.configr   Z_pytest.config.argparsingr   Z_pytest.nodesr   Z_pytest.stashr   r   boolr   r   r   r#   intr   r,   r-   Zhookimplr1   r4   r5   r   r   r   r   <module>   s,   

	

