| Server IP : 127.0.0.1 / Your IP : 216.73.216.109 Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10 System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64 User : SERVERWEB ( 0) PHP Version : 8.1.10 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/cygwin64/lib/python3.9/site-packages/_pytest/__pycache__/ |
Upload File : |
a
05dc � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm Z d dlm
Z
d dlZG dd � d �Zed
d�dd
�Z
ejddd�ed
d�dd��Zejddd�ed
d�dd��Zejddd�ed
d�dd��ZdS )� N)�
TracebackType)�Any)�Callable)� Generator)�Optional)�Typec @ s` e Zd ZdZdd�dd�Zddd�dd �Zd d�d
d�Zeee ee ee
dd�d
d�ZdS )�catch_threading_exceptiona� Context manager catching threading.Thread exception using
threading.excepthook.
Storing exc_value using a custom hook can create a reference cycle. The
reference cycle is broken explicitly when the context manager exits.
Storing thread using a custom hook can resurrect it if it is set to an
object which is being finalized. Exiting the context manager clears the
stored object.
Usage:
with threading_helper.catch_threading_exception() as cm:
# code spawning a thread which raises an exception
...
# check the thread exception: use cm.args
...
# cm.args attribute no longer exists at this point
# (to break a reference cycle)
N��returnc C s d | _ d | _d S �N)�args� _old_hook��self� r �;/usr/lib/python3.9/site-packages/_pytest/threadexception.py�__init__$ s z"catch_threading_exception.__init__zthreading.ExceptHookArgs)r r
c C s
|| _ d S r )r )r r r r r �_hook( s zcatch_threading_exception._hookc C s t j| _| jt _| S r )� threading�
excepthookr
r r r r r � __enter__+ s z#catch_threading_exception.__enter__)�exc_type�exc_val�exc_tbr
c C s$ | j d usJ �| j t_d | _ | `d S r )r
r r r )r r r r r r r �__exit__0 s z"catch_threading_exception.__exit__)�__name__�
__module__�__qualname__�__doc__r r r r r �
BaseExceptionr r r r r r r s
�r )NNNr c c s� t � �v} d V | jrn| jjd u r$dn| jjj}d|� d�}|d�t�| jj| jj| jj ��7 }t
�t�
|�� W d � n1 s�0 Y d S )Nz <unknown>zException in thread z
� )r r �thread�name�join� traceback�format_exceptionr � exc_value�
exc_traceback�warnings�warn�pytestZ%PytestUnhandledThreadExceptionWarning)�cmZthread_name�msgr r r �thread_exception_runtest_hook<