o
    0Gf                     @   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
y,   dZ	Y nw e eZdZzeejddZeejj_W n	 eyM   Y nw erVe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   4lib/python3.10/site-packages/statsmodels/conftest.pypytest_addoption    s$   
r   c                 C   s   d| j v r| jdrtd d| j vr | jdr td d| j v r0| jdr0td d	| j v r@| jd
r@td d	| j v rLtsLtd d| j v r\| jdr\td d| j vrn| jdrptd d S d S 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   sZ   z"dd l }|d zddlm} |  W W d S  ty"   Y W d S w  ty,   Y d S w )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y   dd } Y nw | 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)npZrandomZ	get_stateZseedZ	set_state)stater   r   r   reset_randomstate}   s
   
r#   )ZloggingosZnumpyr!   Zpandaspdr   r   r   r   r   Z	getLogger__name__loggerZcowboolenvirongetoptionsmodeZcopy_on_writeAttributeErrorZcriticalr   r   r   Zfixturer   r#   r   r   r   r   <module>   s<    



(