a :jg? @sddlZddlZddlZddlmZddlZddlZddlmZ ddl m Z m Z m Z mZmZddZddZejjedd d d ZdS) N)reload) assert_raises assert_warnsassert_ assert_equalIS_WASMcCsddl}ddl}|j}tj}tj}ttt|Wdn1sH0Yt ||jut |tjut |tjut t t|j ttt|Wdn1s0Yt ||jut |tjut |tjudS)Nr) numpyZnumpy._globals_NoValueexVisibleDeprecationWarningModuleDeprecationWarningr UserWarningrrr RuntimeErrorZ_globals)nprr r r rD/usr/local/lib/python3.9/site-packages/numpy/tests/test_reloading.pytest_numpy_reloadings  & &rcCsRddl}tdtjdD]4}tt|jdtttj |j|d|juqdS)Nrz )protocol) rrangepickleHIGHEST_PROTOCOLrreprr rloadsdumps)rprotorrr test_novalue)srzcan't start subprocess)reasoncCsFtd}tjtjd|gdd}|jrBtd|jd|j dS)zAt 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_outputzNon-zero return code: z N) textwrapdedent subprocessrunsys executable returncodeAssertionErrorstderrdecode)codeprrrtest_full_reimport1s r,)r$r"r importlibrrZpytestZnumpy.exceptions exceptionsr Z numpy.testingrrrrrrrmarkZskipifr,rrrrs