B
    Z*                 @   s  d Z ddlmZ ddlZdZyddlZW n ek
r@   dZY nX erLeZnddl	Z	ee	j
fZyddlmZ W nh ek
r   yddlmZ W nB ek
r   yddlmZ W n ek
r   edY nX Y nX Y nX dd	 Zd
d Zdd ZeZdd Zd	dddgZdS )z
Compatibility shims to facilitate the transition from nose to pytest.  Can be removed once pytest
is the only way to run tests.
    )PY3NTF)SkipTestzAUnable to locate SkipTest.  unittest, unittest2 or nose required.c                s    fdd}|S )Nc                sN   t | dstrtj S t| ts>t|  fdd}|} d| _	 | _
| S )N__name__c                 s   t  d S )N)r   )argskwargs)reason 9lib/python3.7/site-packages/statsmodels/compat/testing.pyskip_wrapper&   s    z-skip.<locals>.decorator.<locals>.skip_wrapperT)hasattr
has_pytestpytestZmarkskip
isinstance
SKIP_TYPES	functoolswrapsZ__unittest_skip__Z__unittest_skip_why__)Z	test_itemr
   )r   r   r	   	decorator"   s    
zskip.<locals>.decoratorr   )r   r   r   )r   r	   r   !   s    r   c             C   s   | S )Nr   )objr   r   r	   _id3   s    r   c             C   s   | rt |S tS )z/
    Skip a test if the condition is true.
    )r   r   )Z	conditionr   r   r   r	   skipIf7   s    r   c             C   s
   d| _ | S )a  
    Label a test as an example.

    Parameters
    ----------
    t : callable
        The test to label as slow.

    Returns
    -------
    t : callable
        The decorated test `t`.

    Examples
    --------
    The `statsmodels.compat.testing` module includes ``example``.
    A test can be decorated as slow like this::

      from statsmodels.compat.testing import example

      @example
      def test_example(self):
          print('Running an example')
    T)example)tr   r   r	   r   C   s    r   skipifr   )__doc__Zstatsmodels.compat.pythonr   r   r   r   ImportErrortyper   typesZ	ClassTypeZunittest.caser   ZnoseZ	unittest2r   r   r   r   r   __all__r   r   r   r	   <module>   s6   

	