B
    ÐH/\£  ã               @   s|   d dl mZ e ¡  d dlZ e j ¡ dks2tdƒ‚d dl Z d dlmZ	 d dl
Z
dd„ ZG dd„ de	jƒZedkrxe	 ¡  dS )	é    )ÚmonkeyNz&monkey.patch_all() should not init hubc               C   s   t  ¡  t d¡ d S )Ngš™™™™™É?)Ú	threadingZcurrentThreadÚgeventÚsleep© r   r   ú;lib/python3.7/site-packages/gevent/tests/test__threading.pyÚhelper   s    r   c               @   s.   e Zd Zdd„ Zdd„ Ze d¡dd„ ƒZdS )	ÚTestc             C   s€   t tjƒ}|tƒ}t d¡ |  t tjƒ|d ¡ y| ¡  W n* tk
rh   x|j	s`t ¡  qPW ~Y nX |  t tjƒ|¡ d S )Ngš™™™™™¹?é   )
Úlenr   Z_activer   r   r   ZassertEqualÚjoinÚAttributeErrorZdead)ÚselfÚspawnZbeforeÚgr   r   r   Ú_do_test   s    

zTest._do_testc             C   s   |   tj¡ d S )N)r   r   r   )r   r   r   r   Útest_cleanup_gevent*   s    zTest.test_cleanup_geventz-weakref is not cleaned up in a timely fashionc             C   s   |   tj¡ d S )N)r   r   Z	spawn_raw)r   r   r   r   Útest_cleanup_raw-   s    zTest.test_cleanup_rawN)Ú__name__Ú
__module__Ú__qualname__r   r   Ú	greentestZ
skipOnPyPyr   r   r   r   r   r	      s   r	   Ú__main__)r   r   Z	patch_allZ
gevent.hubZhubZ_get_hubÚAssertionErrorZgevent.testingZtestingr   r   r   ZTestCaser	   r   Úmainr   r   r   r   Ú<module>   s     