U
    Ãmœd  ã                   @   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r°e 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   úM/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/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
¡r€t d¡ d	| j kr˜ts˜t d¡ d| j kr¸| j d¡r¸t d¡ d| j krØ| j d¡rØt 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ÚosÚnumpyr!   ZpandasÚpdr   r   r   r   r   Ú	getLoggerÚ__name__ÚloggerÚcowÚboolÚenvironÚgetÚoptionsÚmodeZcopy_on_writeÚAttributeErrorÚcriticalr   r   r   Zfixturer   r%   r   r   r   r   Ú<module>   s6   




(