ó
çiõ\c           @` sÿ   d  Z  d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l	 m
 Z
 d d l	 m Z d d	 l	 m Z d
 „  Z d „  Z e d e ƒ d „  ƒ Z e d e ƒ d „  ƒ Z d „  Z d „  Z e d e ƒ d „  ƒ Z d „  Z d S(   s/    support for skip/xfail functions and markers. i    (   t   absolute_import(   t   division(   t   print_function(   t   hookimpl(   t   MarkEvaluator(   t   fail(   t   skip(   t   xfailc      
   C` sT   |  j  d ƒ } | j d d d d d d t d d	 ƒ|  j d
 d d t d d ƒd  S(   Nt   generals
   --runxfailt   actiont
   store_truet   destt   runxfailt   defaultt   helps<   report the results of xfail tests as if they were not markedt   xfail_stricts\   default for the strict parameter of xfail markers when not given explicitly (default: False)t   typet   bool(   t   getgroupt	   addoptiont   Falset   addini(   t   parsert   group(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_addoption   s    c         ` s™   |  j  j re d d  l ‰ ˆ j ‰  |  j j ‡  ‡ f d †  ƒ d „  } t j | _ t ˆ d | ƒ n  |  j d d ƒ |  j d d ƒ |  j d d ƒ d  S(	   Ni    c           ` s   t  ˆ d ˆ  ƒ S(   NR   (   t   setattr(    (   t   oldt   pytest(    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   <lambda>'   t    c          _` s   d  S(   N(    (   t   argst   kwargs(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   nop)   s    R   t   markerss‘   skip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.s   skipif(condition): skip the given test function if eval(condition) results in a True value.  Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform. see https://docs.pytest.org/en/latest/skipping.htmlsÓ  xfail(condition, reason=None, run=True, raises=None, strict=False): mark the test function as an expected failure if eval(condition) has a True value. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/latest/skipping.html(	   t   optionR   R   R   t   _cleanupt   appendt	   ExceptionR   t   addinivalue_line(   t   configR    (    (   R   R   s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_configure!   s     		t   tryfirstc         C` sÐ   t  |  _ t |  d ƒ } | j ƒ  r@ t |  _ t | j ƒ  ƒ n  xm |  j d d ƒ D]Y } t |  _ d | j k r… t | j d ƒ qS | j	 r¢ t | j	 d ƒ qS t d ƒ qS Wt |  d ƒ |  _
 t |  ƒ d  S(   Nt   skipift   nameR   t   reasoni    s   unconditional skipR   (   R   t   _skipped_by_markR   t   istruet   TrueR   t   getexplanationt   iter_markersR   R   t
   _evalxfailt   check_xfail_no_run(   t   itemt   eval_skipift	   skip_info(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_runtest_setupI   s    				t   hookwrapperc         c` s7   t  |  ƒ d  V} | j d  k } | r3 t |  ƒ n  d  S(   N(   R3   t   excinfot   Nonet   check_strict_xfail(   t
   pyfuncitemt   outcomet   passed(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_pyfunc_call_   s
    
c         C` sW   |  j  j j sS |  j } | j ƒ  rS | j d t ƒ sP t d | j ƒ  ƒ qP qS n  d S(   s   check xfail(run=False)t   runs	   [NOTRUN] N(	   R'   R"   R   R2   R.   t   getR/   R   R0   (   R4   t	   evalxfail(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyR3   h   s
    	c         C` so   |  j  } | j ƒ  rk |  j j d ƒ } | j d | ƒ } | rk |  `  | j ƒ  } t d | d t ƒqk n  d S(   s3   check xfail(strict=True) for the given PASSING testR   t   stricts   [XPASS(strict)] t   pytraceN(   R2   R.   R'   t   getiniRA   R0   R   R   (   R<   RB   t   strict_defaultt   is_strict_xfailt   explanation(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyR;   q   s    	c         c` sR  d  V} | j  ƒ  } t |  d d  ƒ } t |  d ƒ rª | j d k rª d d l m } |  j rt d j |  j ƒ | _	 n	 d | _	 | ƒ  r’ d | _
 qNd	 | _
 | j	 | _ n¤|  j j j r¼ n’| j rü | j j t j ƒ rü d
 | j j j | _ d | _
 nR| rä| j rä| j ƒ  rä| j ƒ  rä| j ri| j | j j ƒ rNd | _
 qád | _
 | j ƒ  | _ qN| j d k rN|  j j d ƒ } | j d | ƒ } | j ƒ  } | rÌd | _
 d j | ƒ | _	 qád	 | _
 | | _ qNnj t |  d t ƒ rN| j rNt | j	 ƒ t k rN| j	 \ }	 }
 } |  j d  \ }	 }
 |	 |
 | f | _	 n  d  S(   NR2   t   _unexpectedsuccesst   calli    (   t)   _is_unittest_unexpected_success_a_failures   Unexpected success: {}s   Unexpected successt   failedR>   s   reason: t   skippedR   RC   s   [XPASS(strict)] {}R-   i   (    t
   get_resultt   getattrR:   t   hasattrt   whent   _pytest.compatRK   RI   t   formatt   longreprR=   t   wasxfailR'   R"   R   R9   t   errisinstanceR   R%   t   valuet   msgRM   t   wasvalidR.   t   invalidraiseR0   RE   RA   R   R   t   tuplet   location(   R4   RJ   R=   t   repRB   RK   RF   RG   RH   t   filenamet   lineR,   (    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_runtest_makereport}   sL    				(					c         C` s0   t  |  d ƒ r, |  j r d S|  j r, d	 Sn  d  S(
   NRU   t   xfailedt   xt   XFAILt   xpassedt   Xt   XPASS(   Ra   Rb   Rc   (   Rd   Re   Rf   (   RP   RM   R>   (   t   report(    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   pytest_report_teststatusµ   s
    		N(   t   __doc__t
   __future__R    R   R   t   _pytest.configR   t   _pytest.mark.evaluateR   t   _pytest.outcomesR   R   R   R   R(   R/   R7   R?   R3   R;   R`   Rh   (    (    (    s/   lib/python2.7/site-packages/_pytest/skipping.pyt   <module>   s    		(				8