ó
áp7]c           @   sž   d  d l  Z d  d l Z y# d  d l Z e j d ƒ e Z Wn e k
 rT e Z n Xd „  Z	 d „  Z
 d „  Z e j ƒ  d „  ƒ Z e j ƒ  d „  ƒ Z d S(   iÿÿÿÿNt   aggc         C   sš   |  j  d d d d d ƒ|  j  d d d d d ƒ|  j  d d d d d	 ƒ|  j  d
 d d d d ƒ|  j  d d d d d ƒ|  j  d d d d d ƒd  S(   Ns   --skip-slowt   actiont
   store_truet   helps   skip slow testss   --only-slows   run only slow testss   --skip-exampless   skip tests of exampless   --skip-matplotlibs$   skip tests that depend on matplotlibs   --skip-smokes   skip smoke testss   --only-smokes   run only smoke tests(   t	   addoption(   t   parser(    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   pytest_addoption   s    c         C   sP  d |  j  k r1 |  j j d ƒ r1 t j d ƒ n  d |  j  k rb |  j j d ƒ rb t j d ƒ n  d |  j  k r“ |  j j d ƒ r“ t j d ƒ n  d	 |  j  k rÄ |  j j d
 ƒ rÄ t j d ƒ n  d	 |  j  k rê t rê t j d ƒ n  d |  j  k r|  j j d ƒ rt j d ƒ n  d |  j  k rL|  j j d ƒ rLt j d ƒ n  d  S(   Nt   slows   --skip-slows   skipping due to --skip-slows   --only-slows   skipping due to --only-slowt   examples   --skip-exampless   skipping due to --skip-examplest
   matplotlibs   --skip-matplotlibs!   skipping due to --skip-matplotlibs)   skipping since matplotlib is not intalledt   smokes   --skip-smokes   skipping due to --skip-smokes   --only-smokes   skipping due to --only-smoke(   t   keywordst   configt	   getoptiont   pytestt   skipt   HAVE_MATPLOTLIB(   t   item(    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   pytest_runtest_setup   s    !!!!!c         C   s5   y d d  l  } | j d ƒ Wn t k
 r0 n Xd  S(   NiÿÿÿÿR    (   R	   t   uset   ImportError(   R   R	   (    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   pytest_configure4   s
    c          #   sL   y d d l  ‰  ‡  f d †  }  Wn t k
 r; d „  }  n X|  V|  ƒ  d S(   sœ  
    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()
    iÿÿÿÿNc              s   ˆ  j  j d ƒ d  S(   Nt   all(   t   pyplott   close(    (   R	   (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyR   Z   s    c           S   s   d  S(   N(    (    (    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyR   ^   s    (   t   matplotlib.pyplotR   (   R   (    (   R	   s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   close_figures<   s    c          c   s8   t  j j ƒ  }  t  j j d ƒ d Vt  j j |  ƒ d S(   s'  
    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
    i   N(   t   npt   randomt	   get_statet   seedt	   set_state(   t   state(    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   reset_randomstatee   s    (   t   numpyR   R   R	   R   t   TrueR   R   t   FalseR   R   R   t   fixtureR   R!   (    (    (    s3   lib/python2.7/site-packages/statsmodels/conftest.pyt   <module>   s   

			)