
    i                     T   d dl mZmZmZ d dlZd dlZd dlZddlmZ ddlm	Z	  G d de
          Z G d d	ej                  Z G d
 de          Z G d de          Z G d de          Zd ZeZeZeZej        sej        rej        rd Zd Zej        reZeZe
efdZe
fdZdS )    )absolute_importprint_functiondivisionN   )sysinfo)sixc                       e Zd ZdZdS )FlakyAssertionErrorz2Re-raised so that we know it's a known-flaky test.N__name__
__module____qualname____doc__     ?/usr/local/lib/python3.11/dist-packages/gevent/testing/flaky.pyr
   r
      s        8888r   r
   c                       e Zd ZdZdS )	FlakyTestz
    A unittest exception that causes the test to be skipped when raised.

    Use this carefully, it is a code smell and indicates an undebugged problem.
    Nr   r   r   r   r   r   #   s           r   r   c                       e Zd ZdZdS )FlakyTestRaceConditionzP
    Use this when the flaky test is definitely caused by a race condition.
    Nr   r   r   r   r   r   *              r   r   c                       e Zd ZdZdS )FlakyTestTimeoutzY
    Use this when the flaky test is definitely caused by an
    unexpected timeout.
    Nr   r   r   r   r   r   /   s           r   r   c                       e Zd ZdZdS )FlakyTestCrashesz3
    Use this when the test sometimes crashes.
    Nr   r   r   r   r   r   5   r   r   r   c                      t          j        t          t          t          j                    d                   t          j                    d                    d S Nr      )r   reraiser
   sysexc_infor   r   r   reraiseFlakyTestRaceConditionr"   :   sG    K##CLNN1$566q!# # # # #r   c                      t          t          j                    d                   } t          j        t
          t          |           t          j                    d                    d S r   )strr    r!   r   r   r   msgs    r   r"   r"   E   sV     #,..#$$**3//LNN1%	' 	' 	' 	' 	'r   c                      t          t          j                    d                   } t          j        t
          t          |           t          j                    d                    d S r   )r$   r    r!   r   r   r   r%   s    r   reraiseFlakyTestTimeoutr(   Y   sT    #,..#$$$$S))LNN1%	' 	' 	' 	' 	'r   c                       fd}|S )Nc                 L     t          j                    fd            }|S )Nc                  @    	  |   d S # $ r               Y d S w xY w)Nr   )args_funcexc_kindfs    r   mz2reraises_flaky_timeout.<locals>.wrapper.<locals>.mg   sC    4   s   
 )	functoolswraps)r/   r0   r-   r.   s   ` r   wrapperz'reraises_flaky_timeout.<locals>.wrapperf   sC    				 	 	 	 	 	 
		
 r   r   )r.   r-   r3   s   `` r   reraises_flaky_timeoutr4   d   s)          Nr   c                 .    t          | t                    S )N)r-   )r4   r"   )r.   s    r   reraises_flaky_race_conditionr6   q   s    !(2OPPPPr   )
__future__r   r   r   r    r1   unittest r   r   AssertionErrorr
   SkipTestr   r   r   r   r"   r(   "reraiseFlakyTestRaceConditionLibuvreraiseFlakyTestTimeoutLibuvRUNNING_ON_CIPYPYWINLIBUVr4   r6   r   r   r   <module>rB      s  ( A @ @ @ @ @ @ @ @ @ 



                 9 9 9 9 9. 9 9 9    !       Y   
    y       y   
# # #
 8 %B "< 
 ?W\ ?gk ?' ' '(' ' ' } ?-J*'>$ %3:Q     ,: Q Q Q Q Q Qr   