U
    ºmœd 	  ã                   @   s6  d Z ddlZddlZddlZddlmZ ddlmZmZ zddl	Z	W n e
k
r\   dZ	Y nX eedƒZzddlZdd„ ZW n  e
k
rœ   dd„ ZdZY nX z dd	lmZ d
d„ Zdd„ ZW n$ e
k
râ   dd„ Zd ZZY nX dd„ Zeedkdd�Zeej d¡ dd�Zee	dkdd�Zee	dk	dd�ZdS )z
Small utilities for testing.
é    N)Úmp)ÚSkipTestÚskipifÚpypy_version_infoc                 C   s   | S )ú*A decorator to skip tests requiring numpy.© ©Úfuncr   r   úK/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/joblib/test/common.pyÚ
with_numpy   s    r   c                 C   s   dd„ }|S )r   c                   S   s   t dƒ‚d S )NzTest requires numpy©r   r   r   r   r
   Úmy_func   s    zwith_numpy.<locals>.my_funcr   )r	   r   r   r   r
   r      s    )Úmemory_usagec                 C   s   | S )ú4A decorator to skip tests requiring memory_profiler.r   r   r   r   r
   Úwith_memory_profiler)   s    r   c                 O   s*   t  ¡  t| ||fdd�}t|ƒt|ƒ S )z)Compute memory usage when executing func.gü©ñÒMbP?)Úinterval)ÚgcÚcollectr   ÚmaxÚmin)r	   ÚargsÚkwargsZmem_user   r   r
   Úmemory_used-   s    r   c                 C   s   dd„ }|S )r   c                   S   s   t dƒ‚d S )NzTest requires memory_profiler.r   r   r   r   r
   Ú
dummy_func6   s    z(with_memory_profiler.<locals>.dummy_funcr   )r	   r   r   r   r
   r   4   s    c                  C   s    t rdd l} |  ¡  |  ¡  d S )Nr   )ÚIS_PYPYr   r   )r   r   r   r
   Úforce_gc_pypy=   s    r   zNeeds multiprocessing to run.)Úreasonz/dev/shmz5This test requires a large /dev/shm shared memory fs.zNeeds lz4 compression to runz$Needs lz4 not being installed to run)Ú__doc__Úosr   ÚsysZjoblib._multiprocessing_helpersr   Zjoblib.testingr   r   Zlz4ÚImportErrorÚhasattrr   ÚnumpyÚnpr   Zmemory_profilerr   r   r   r   Zwith_multiprocessingÚpathÚexistsZwith_dev_shmZwith_lz4Zwithout_lz4r   r   r   r
   Ú<module>   sJ   


 ÿþ ÿ