U
    Kvf                     @   s   d dl Z d dlZd dlZd dlZd dlZzd dlZed dZ	W n e
k
rZ   dZ	Y nX e eZdZz eejddZeejj_W n ek
r   Y nX ered n
ed dd	 Zd
d Zdd Ze dd Ze dd ZdS )    NaggTFZSM_TEST_COPY_ON_WRITEzCopy on Write Enabled!zCopy on Write disabledc                 C   sd   | j dddd | j dddd | j dddd | j d	dd
d | j dddd | j dddd d S )N--skip-slow
store_truezskip slow tests)actionhelp--only-slowzrun only slow tests--skip-exampleszskip tests of examples--skip-matplotlibz$skip tests that depend on matplotlib--skip-smokezskip smoke tests--only-smokezrun only smoke tests)Z	addoption)parser r   8/tmp/pip-unpacked-wheel-2v6byqio/statsmodels/conftest.pypytest_addoption    s$    r   c                 C   s   d| j kr | jdr td d| j kr@| jdr@td d| j kr`| jdr`td d	| j kr| jd
rtd d	| j krtstd d| j kr| jdrtd d| j kr| jdrtd d S )NZslowr   zskipping due to --skip-slowr   zskipping due to --only-slowZexampler   zskipping due to --skip-examples
matplotlibr	   z!skipping due to --skip-matplotlibz)skipping since matplotlib is not intalledZsmoker
   zskipping due to --skip-smoker   zskipping due to --only-smoke)keywordsconfigZ	getoptionpytestskipHAVE_MATPLOTLIB)itemr   r   r   pytest_runtest_setup/   s     







r   c                 C   s\   zBdd l }|d zddlm} |  W n tk
r>   Y nX W n tk
rV   Y nX d S )Nr   r   )register_matplotlib_converters)r   useZpandas.plottingr   ImportError)r   r   r   r   r   r   pytest_configureG   s    


r   c                  #   sF   zddl   fdd} W n tk
r4   dd } Y nX | V  |   dS )a  
    Fixture that closes all figures after a test function has completed

    Returns
    -------
    closer : callable
        Function that will close all figures when called.

    Notes
    -----
    Used by passing as an argument to the function that produces a plot,
    for example

    def test_some_plot(close_figures):
        <test code>

    If a function creates many figures, then these can be destroyed within a
    test function by calling close_figures to ensure that the number of
    figures does not become too large.

    def test_many_plots(close_figures):
        for i in range(100000):
            plt.plot(x,y)
            close_figures()
    r   Nc                      s    j d d S )Nall)Zpyplotcloser   r   r   r   r   r   s    zclose_figures.<locals>.closec                   S   s   d S )Nr   r   r   r   r   r   v   s    )Zmatplotlib.pyplotr   )r   r   r   r   close_figuresT   s    r   c                  c   s,   t j } t jd dV  t j|  dS )a'  
    Fixture that set the global RandomState to the fixed seed 1

    Notes
    -----
    Used by passing as an argument to the function that uses the global
    RandomState

    def test_some_plot(reset_randomstate):
        <test code>

    Returns the state after the test function exits
       N)nprandomZ	get_stateseedZ	set_state)stater   r   r   reset_randomstate}   s    
r%   )loggingosZnumpyr!   Zpandaspdr   r   r   r   r   	getLogger__name__loggerZcowboolenvirongetoptionsmodeZcopy_on_writeAttributeErrorcriticalr   r   r   Zfixturer   r%   r   r   r   r   <module>   s6   




(