o
    ðT·j?	  ã                   @   sˆ   d dl Z d dlZd dlZd dlmZ d dlZd dlZd dlmZ	 d dl
mZmZmZmZmZ dd„ Zdd„ Zejjedd	�d
d„ ƒZdS )é    N)Úreload)Úassert_raisesÚassert_warnsÚassert_Úassert_equalÚIS_WASMc                  C   sè   dd l } dd l}| j}tj}tj}ttƒ� t| ƒ W d   ƒ n1 s$w   Y  t	|| ju ƒ t	|tju ƒ t	|tju ƒ t
tt|jƒ ttƒ� t| ƒ W d   ƒ n1 sXw   Y  t	|| ju ƒ t	|tju ƒ t	|tju ƒ d S )Nr   )ÚnumpyÚnumpy._globalsÚ_NoValueÚexÚVisibleDeprecationWarningÚModuleDeprecationWarningr   ÚUserWarningr   r   r   ÚRuntimeErrorÚ_globals)Únpr   r
   r   r   © r   ú]/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/numpy/tests/test_reloading.pyÚtest_numpy_reloading   s$   

ÿ

ÿr   c                  C   sR   dd l } tdtjd ƒD ]}tt| jƒdƒ tt tj	| j|d�¡| ju ƒ qd S )Nr   é   é   z
<no value>)Úprotocol)
r   ÚrangeÚpickleÚ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r!t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_reimport1   s   
	ÿÿr.   )r&   r$   r"   Ú	importlibr   r   ÚpytestÚnumpy.exceptionsÚ
exceptionsr   Únumpy.testingr   r   r   r   r   r   r   ÚmarkÚskipifr.   r   r   r   r   Ú<module>   s    	