U
    ¸mœd2	  ã                   @   s€   d dl mZmZmZmZmZ d dlmZ d dlZd dl	Z	d dl
Z
d dlZd dlmZ dd„ Zdd„ Zejjed	d
�dd„ ƒZdS )é    )Úassert_raisesÚassert_warnsÚassert_Úassert_equalÚIS_WASM)ÚpickleN)Úreloadc               	   C   sÀ   dd l } dd l}| j}| j}| j}ttƒ� t| ƒ W 5 Q R X t|| jkƒ t|| jkƒ t|| jkƒ t	t
t|jƒ ttƒ� t| ƒ W 5 Q R X t|| jkƒ t|| jkƒ t|| jkƒ d S )Nr   )ÚnumpyZnumpy._globalsÚ_NoValueÚVisibleDeprecationWarningÚModuleDeprecationWarningr   ÚUserWarningr   r   r   ÚRuntimeErrorZ_globals)Únpr	   r
   r   r   © r   úS/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/numpy/tests/test_reloading.pyÚtest_numpy_reloading   s     

r   c                  C   sR   dd l } tdtjd ƒD ]4}tt| jƒdƒ tt tj	| j|d�¡| jkƒ qd S )Nr   é   é   z
<no value>)Úprotocol)
r	   Úranger   ÚHIGHEST_PROTOCOLr   Úreprr
   r   ÚloadsÚdumps)r   Úprotor   r   r   Útest_novalue'   s    ÿÿr   zcan't start subprocess)Úreasonc                  C   sF   t  d¡} tjtjd| gdd�}|jrBtd|j›d|j 	¡ › �ƒ‚dS )z²At the time of writing this, it is *not* truly supported, but
    apparently enough users rely on it, for it to be an annoying change
    when it started failing previously.
    a  
        import sys
        from pytest import warns
        import numpy as np

        for k in list(sys.modules.keys()):
            if "numpy" in k:
                del sys.modules[k]

        with warns(UserWarning):
            import numpy as np
        z-cT)Úcapture_outputzNon-zero return code: z

N)
ÚtextwrapÚdedentÚ
subprocessÚrunÚsysÚ
executableÚ
returncodeÚAssertionErrorÚstderrÚdecode)ÚcodeÚpr   r   r   Útest_full_reimport/   s    	
ÿr+   )Znumpy.testingr   r   r   r   r   Znumpy.compatr   Zpytestr#   r!   r   Ú	importlibr   r   r   ÚmarkZskipifr+   r   r   r   r   Ú<module>   s   