σ
ηiυ\c           @` s9  d  Z  d d l m Z d d l m Z d d l m Z d d l Z d d l m Z d e f d     YZ	 e	 e
 f Z d	 e	 f d
     YZ d e	 f d     YZ d e
 f d     YZ d d  Z e e _
 d d  Z e e _
 d e d  Z e e _
 d e j
 f d     YZ d d  Z e e _
 d d d  Z d S(   s[   
exception classes and constants handling test outcomes
as well as functions creating them
i    (   t   absolute_import(   t   division(   t   print_functionN(   t   Versiont   OutcomeExceptionc           B` s,   e  Z d  Z d e d  Z d   Z e Z RS(   sw    OutcomeException and its subclass instances indicate and
        contain info about test and collection outcomes.
    c         C` s&   t  j |  |  | |  _ | |  _ d  S(   N(   t   BaseExceptiont   __init__t   msgt   pytrace(   t   selfR   R   (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR      s    	c         C` sN   |  j  r= |  j  } t | t  r9 | j d d d } n  | Sd |  j j f S(   Ns   UTF-8t   errorst   replaces   <%s instance>(   R   t
   isinstancet   bytest   decodet	   __class__t   __name__(   R	   t   val(    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   __repr__   s    		N(   R   t
   __module__t   __doc__t   Nonet   TrueR   R   t   __str__(    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR      s   	t   Skippedc           B` s    e  Z d  Z d e e d  Z RS(   t   builtinsc         C` s&   t  j |  d | d | | |  _ d  S(   NR   R   (   R   R   t   allow_module_level(   R	   R   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR   ,   s    N(   R   R   R   R   t   FalseR   (    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR   '   s   t   Failedc           B` s   e  Z d  Z d Z RS(   s/    raised from an explicit call to pytest.fail() R   (   R   R   R   (    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR   1   s   t   Exitc           B` s   e  Z d  Z d d d  Z RS(   s=    raised for immediate program exits (no tracebacks/summaries)s   unknown reasonc         C` s,   | |  _  | |  _ t t |   j |  d  S(   N(   R   t
   returncodet   superR   R   (   R	   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR   :   s    		N(   R   R   R   R   R   (    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR   7   s   c         C` s   t  } t |  |   d S(   s   
    Exit testing process.

    :param str msg: message to display upon exit.
    :param int returncode: return code to be used when exiting pytest.
    N(   R   R   (   R   R   t   __tracebackhide__(    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   exitC   s    t    c         K` sU   t  } | j d t  } | r< t d j t |     n  t d |  d |   d S(   s)  
    Skip an executing test with the given message.

    This function should be called only during testing (setup, call or teardown) or
    during collection by using the ``allow_module_level`` flag.  This function can
    be called in doctests as well.

    :kwarg bool allow_module_level: allows this function to be called at
        module level, skipping the rest of the module. Default to False.

    .. note::
        It is better to use the :ref:`pytest.mark.skipif ref` marker when possible to declare a test to be
        skipped under certain conditions like mismatching platforms or
        dependencies.
        Similarly, use the ``# doctest: +SKIP`` directive (see `doctest.SKIP
        <https://docs.python.org/3/library/doctest.html#doctest.SKIP>`_)
        to skip a doctest statically.
    R   s    unexpected keyword arguments: {}R   N(   R   t   popR   t	   TypeErrort   formatt   sortedR   (   R   t   kwargsR    R   (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   skipQ   s
    c         C` s   t  } t d |  d |   d S(   s  
    Explicitly fail an executing test with the given message.

    :param str msg: the message to show the user as reason for the failure.
    :param bool pytrace: if false the msg represents the full failure information and no
        python traceback will be reported.
    R   R   N(   R   R   (   R   R   R    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   failn   s    t   XFailedc           B` s   e  Z d  Z RS(   s0    raised from an explicit call to pytest.xfail() (   R   R   R   (    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyR*   }   s   c         C` s   t  } t |    d S(   sr  
    Imperatively xfail an executing test or setup functions with the given reason.

    This function should be called only during testing (setup, call or teardown).

    .. note::
        It is better to use the :ref:`pytest.mark.xfail ref` marker when possible to declare a test to be
        xfailed under certain conditions like known bugs or missing features.
    N(   R   R*   (   t   reasonR    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   xfail   s    
c   	   	   C` s4  d d l  } t } t |  d d  d } | j   < | j d  y t |   Wn t k
 rk } | } n XWd QX| r¬ | d k r d |  | f } n  t | d t  n  t	 j
 |  } | d k rΙ | St | d d  } | d k	 r0| d k st |  t |  k  r0t d	 |  | | f d t  q0n  | S(
   sΛ  Imports and returns the requested module ``modname``, or skip the current test
    if the module cannot be imported.

    :param str modname: the name of the module to import
    :param str minversion: if given, the imported module ``__version__`` attribute must be
        at least this minimal version, otherwise the test is still skipped.
    :param str reason: if given, this reason is shown as the message when the module
        cannot be imported.
    i    NR"   t   evalt   ignores   could not import %r: %sR   t   __version__s-   module %r has __version__ %r, required is: %r(   t   warningsR   t   compileR   t   catch_warningst   simplefiltert
   __import__t   ImportErrorR   t   syst   modulest   getattrR   (	   t   modnamet
   minversionR+   R0   R    t
   import_exct   exct   modt   verattr(    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   importorskip   s2    
$(   R   t
   __future__R    R   R   R6   t   packaging.versionR   R   R   t	   Exceptiont   TEST_OUTCOMER   R   R   R   R!   R(   R   R)   R*   R,   R?   (    (    (    s/   lib/python2.7/site-packages/_pytest/outcomes.pyt   <module>   s(   
				