a
    vÜao  ã                   @   s>   d dl Z d dlZd dlZG dd„ deƒZG dd„ de jƒZdS )é    Nc                   @   s   e Zd ZdS )Ú	SomeErrorN)Ú__name__Ú
__module__Ú__qualname__© r   r   ú:lib/python3.9/site-packages/greenlet/tests/test_tracing.pyr      s   r   c                   @   s"   e Zd Zejrdd„ Zdd„ ZdS )ÚTracingTestsc              	      s°   t  ¡ }g ‰ ‡ fdd„}dd„ }dd„ }t  |¡}z8t   |¡}| ¡  t   |¡}|  t|j¡ W t  |¡ nt  |¡ 0 |  ˆ d||ffd||ffd||ffd||ffg¡ d S )	Nc                     s   ˆ   | ¡ d S ©N)Úappend©Úargs©Úactionsr   r   Útrace   s    z1TracingTests.test_greenlet_tracing.<locals>.tracec                   S   s   d S r	   r   r   r   r   r   Údummy   s    z1TracingTests.test_greenlet_tracing.<locals>.dummyc                   S   s
   t ƒ ‚d S r	   )r   r   r   r   r   Údummyexc   s    z4TracingTests.test_greenlet_tracing.<locals>.dummyexcÚswitchÚthrow)ÚgreenletÚ
getcurrentÚsettracer   ÚassertRaisesr   ÚassertEqual)ÚselfÚmainr   r   r   ÚoldtraceZg1Zg2r   r   r   Útest_greenlet_tracing
   s$    






üz"TracingTests.test_greenlet_tracingc              	      s”   t  ¡ ‰g ‰ ‡ fdd„}‡fdd„}t   |¡}| ¡  t  |¡}z,|  t|j¡ |  t  ¡ d ¡ W t  |¡ nt  |¡ 0 |  ˆ dˆ|ffg¡ d S )Nc                     s   ˆ   | ¡ tƒ ‚d S r	   )r
   r   r   r   r   r   r   %   s    
z;TracingTests.test_exception_disables_tracing.<locals>.tracec                      s   ˆ   ¡  d S r	   )r   r   )r   r   r   r   (   s    z;TracingTests.test_exception_disables_tracing.<locals>.dummyr   )r   r   r   r   r   r   r   Úgettrace)r   r   r   Úgr   r   )r   r   r   Útest_exception_disables_tracing"   s    


ÿz,TracingTests.test_exception_disables_tracingN)r   r   r   r   ZGREENLET_USE_TRACINGr   r   r   r   r   r   r      s   r   )ZunittestZ	threadingr   Ú	Exceptionr   ZTestCaser   r   r   r   r   Ú<module>   s   