o
    #if                     @   s  d dl 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	 d dl
mZ d dlZee  Zee  Zdeddfd	d
ZdeddfddZdeddfddZdefddZdedefddZejdddde	dedeef fddZejdddddZejdddddZdS )    N)	Generator)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)addini)r   help r   M/var/www/html/corbot_env/lib/python3.10/site-packages/_pytest/faulthandler.pypytest_addoption   s   r   configc                 C   sF   dd l }t }| r|| jt< t|| jt< |j| jt d d S Nr   )file)	faulthandlerget_stderr_fileno
is_enabledstash$fault_handler_original_stderr_fd_keyosdupfault_handler_stderr_fd_keyenable)r   r   stderr_filenor   r   r   pytest_configure   s   
r   c                 C   s\   dd l }|  t| jv rt| jt  | jt= t| jv r,|| jt  | jt= d S d S )Nr   )r   disabler   r   r   closer   r   )r   r   r   r   r   pytest_unconfigure'   s   

r!   c               	   C   s@   zt j } | dkrt | W S  ttfy   t j  Y S w )N)sysstderrfilenoAttributeError
ValueError
__stderr__)r%   r   r   r   r   5   s   
r   c                 C   s   t | dpdS )Nr	   r
   )floatgetini)r   r   r   r   get_timeout_config_valueD   s   r+   T)wrappertrylastitemc                 c   sX    t | j}|dkr)dd l}| jjt }|j||d zd V W |  S |  w d V S r   )r+   r   r   r   r   dump_traceback_latercancel_dump_traceback_later)r.   timeoutr   r$   r   r   r   pytest_runtest_protocolH   s   
r2   )tryfirstc                  C      ddl } |   dS )z@Cancel any traceback dumping due to timeout before entering pdb.r   Nr   r0   r   r   r   r   pytest_enter_pdbX   s   r7   c                  C   r4   )zNCancel any traceback dumping due to an interactive exception being
    raised.r   Nr5   r6   r   r   r   pytest_exception_interact`   s   r8   )r   N)r   r#   typingr   _pytest.configr   _pytest.config.argparsingr   _pytest.nodesr   _pytest.stashr   pytestintr   r   r   r   r!   r   r)   r+   hookimplobjectr2   r7   r8   r   r   r   r   <module>   s*    



