o
    Ú­jú  ã                   @   s  d dl Z d dl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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 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   úQ/var/www/html/CropPilot/venv/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)ÚhookwrapperÚtrylastÚitem)NNNc                 c   s`   � t | jƒ}|dkr+dd l}| jjt }|j||d� z
d V  W | ¡  d S | ¡  w d V  d 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Ú_pytest.configr   Ú_pytest.config.argparsingr   Ú_pytest.nodesr   Ú_pytest.stashr   Úintr   r   r   r   r!   r   r)   r+   Úhookimplr2   r7   r8   r   r   r   r   Ú<module>   s*    



