a :jg@sJdZddlZddlZddlZddlZddlZddlmZdaiZ ej ej edejjddddejjdddddeejd ej ej ed d Zejej erdndd ejd <ddZddZddZeddZejdddddZejddddZ ejddddZ!ejddgd d!d"Z"dS)#z= Pytest configuration and fixtures for the Numpy test suite. N) get_fpu_modez .hypothesisz numpy-profileT)namedeadline print_blobznp.test() profile)rrrZdatabaseZ derandomizeZsuppress_health_checkz..z pytest.ini1ZNUMPY_EXPERIMENTAL_DTYPE_APIcCs4|dd|dd|dd|dddS)Nmarkersz=valgrind_error: Tests that are known to error under valgrind.z:leaks_references: Tests that are known to leak references.zslow: Tests that are very slow.z,slow_pypy: Tests that are very slow on pypy.)Zaddinivalue_line)configr 8/usr/local/lib/python3.9/site-packages/numpy/conftest.pypytest_configure.sr cCs|jddddddS)Nz--available-memorystorezSet amount of memory available for running the test suite. This can result to tests requiring especially large amounts of memory to be skipped. Equivalent to setting environment variable NPY_AVAILABLE_MEM. Default: determinedautomatically.)actiondefaulthelp)Z addoption)parserr r r pytest_addoption9s rcCs"|jd}|dur|tjd<dS)NZavailable_memoryZNPY_AVAILABLE_MEM)rZ getoptionosenviron)sessionZ available_memr r r pytest_sessionstartCs rcCs0t}tdur|an|tkr,t|ft|<|adS)z Check FPU precision mode was not changed during test collection. The clumsy way we do it here is mainly necessary because numpy still uses yield tests, which can execute code at test collection time. N)r _old_fpu_mode_collect_results)itemmoder r r pytest_itemcollectedJs  rfunction)scopeautouseccsZt}dVt}||kr*td||t|j}|durV|\}}td||dS)zC Check FPU precision mode was not changed during the test. Nz@FPU precision mode changed from {0:#x} to {1:#x} during the testzIFPU precision mode changed from {0:#x} to {1:#x} when collecting the test)rAssertionErrorformatrgetnode)requestZold_modeZnew_modeZcollect_resultr r r check_fpu_mode^s r#)rcCs t|d<dS)Nnp)numpy)Zdoctest_namespacer r r add_npssr&cCs|dddS)NZPYTHONHASHSEED0)Zsetenv)Z monkeypatchr r r env_setupwsr(F)paramsccs:t}|jrtdn td|jVt|dS)z Fixture to ensure "legacy" promotion state or change it to use the new weak promotion (plus warning). `old_promotion` should be used as a parameter in the function. Z weak_and_warnlegacyN)r%Z_get_promotion_stateparamZ_set_promotion_state)r"stater r r weak_promotion|s   r-)#__doc__rtempfileZ hypothesisZpytestr%Znumpy._core._multiarray_testsrrr configurationZset_hypothesis_home_dirpathjoin gettempdirsettingsZregister_profilelistZ HealthCheckdirname__file__Z _pytest_iniZ load_profileisfilerr rrZhookimplrZfixturer#r&r(r-r r r r sJ