B
    H/\                 @   s   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 de
ZG dd	 d	ejZG d
d deZG dd deZG dd deZdd ZeZeZeZejsejrejrdd Zdd ZejreZeZe
efddZe
fddZdS )    )absolute_importprint_functiondivisionN   )sysinfo)sixc               @   s   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__ r   r   3lib/python3.7/site-packages/gevent/testing/flaky.pyr      s   r   c               @   s   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.
    N)r	   r
   r   r   r   r   r   r   r   #   s   r   c               @   s   e Zd ZdZdS )FlakyTestRaceConditionzP
    Use this when the flaky test is definitely caused by a race condition.
    N)r	   r
   r   r   r   r   r   r   r   *   s   r   c               @   s   e Zd ZdZdS )FlakyTestTimeoutzY
    Use this when the flaky test is definitely caused by an
    unexpected timeout.
    N)r	   r
   r   r   r   r   r   r   r   /   s   r   c               @   s   e Zd ZdZdS )FlakyTestCrashesz3
    Use this when the test sometimes crashes.
    N)r	   r
   r   r   r   r   r   r   r   5   s   r   c               C   s&   t ttt d t d  d S )Nr      )r   reraiser   sysexc_infor   r   r   r   reraiseFlakyTestRaceCondition:   s    r   c              C   s.   t t d } ttt| t d  d S )Nr   r   )strr   r   r   r   r   )msgr   r   r   r   E   s    c              C   s.   t t d } ttt| t d  d S )Nr   r   )r   r   r   r   r   r   )r   r   r   r   reraiseFlakyTestTimeoutY   s    r   c                s    fdd}|S )Nc                s   t   fdd}|S )Nc                 s,   y|   W n k
r&      Y nX d S )Nr   )args)_funcexc_kindfr   r   mg   s    z2reraises_flaky_timeout.<locals>.wrapper.<locals>.m)	functoolswraps)r   r   )r   r   )r   r   wrapperf   s    z'reraises_flaky_timeout.<locals>.wrapperr   )r   r   r"   r   )r   r   r   reraises_flaky_timeoutd   s    	r#   c             C   s   t | tdS )N)r   )r#   r   )r   r   r   r   reraises_flaky_race_conditionq   s    r$   )Z
__future__r   r   r   r   r    Zunittest r   r   AssertionErrorr   ZSkipTestr   r   r   r   r   r   Z"reraiseFlakyTestRaceConditionLibuvZreraiseFlakyTestTimeoutLibuvZRUNNING_ON_CIZPYPYZWINZLIBUVr#   r$   r   r   r   r   <module>   s,   