3
K^
                 @   s   d Z ddlmZmZmZ ddlZddlZddlZddlm	Z	 da
i Zdd Zdd Zd	d
 Zej dd Zejddddd Zejdddd ZdS )z=
Pytest configuration and fixtures for the Numpy test suite.
    )divisionabsolute_importprint_functionN)get_fpu_modec             C   s(   | j dd | j dd | j dd d S )Nmarkersz=valgrind_error: Tests that are known to error under valgrind.z:leaks_references: Tests that are known to leak references.zslow: Tests that are very slow.)Zaddinivalue_line)config r   2/tmp/pip-unpacked-wheel-4ferv4jf/numpy/conftest.pypytest_configure   s    r
   c             C   s   | j ddd dd d S )Nz--available-memorystorezSet 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.)actiondefaulthelp)Z	addoption)parserr   r   r	   pytest_addoption   s    
r   c             C   s"   | j jd}|d k	r|tjd< d S )NZavailable_memoryZNPY_AVAILABLE_MEM)r   Z	getoptionosenviron)sessionZavailable_memr   r   r	   pytest_sessionstart%   s    r   c             C   s0   t  }tdkr|an|tkr,t|ft| < |adS )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)itemmoder   r   r	   pytest_itemcollected,   s    r   functionT)Zscopeautousec             c   sZ   t  }dV  t  }||kr*tdj||tj| j}|dk	rV|\}}tdj||dS )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)r   AssertionErrorformatr   getnode)requestZold_modeZnew_modeZcollect_resultr   r   r	   check_fpu_mode@   s    
r!   )r   c             C   s   t | d< d S )Nnp)numpy)Zdoctest_namespacer   r   r	   add_npU   s    r$   )__doc__
__future__r   r   r   r   Zpytestr#   Znumpy.core._multiarray_testsr   r   r   r
   r   r   Zhookimplr   Zfixturer!   r$   r   r   r   r	   <module>   s   	
