ó
çiõ\c           @   s>   d  d l  Z  d „  Z e  j d „  ƒ Z d d d „  ƒ  YZ d S(   iÿÿÿÿNc      	   C   sT   |  j  d ƒ } | j d d d d d d d d	 ƒ| j d
 d d d d d d ƒd  S(   Nt   generals   --sws
   --stepwiset   actiont
   store_truet   destt   stepwiset   helpsB   exit on test failure and continue from last failing test next times   --stepwise-skipt   stepwise_skips?   ignore the first failing test but stop on the next failing test(   t   getgroupt	   addoption(   t   parsert   group(    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_addoption   s    c         C   s   |  j  j t |  ƒ d ƒ d  S(   Nt   stepwiseplugin(   t   pluginmanagert   registert   StepwisePlugin(   t   config(    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_configure   s    R   c           B   sG   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s^   | |  _  | j d ƒ |  _ d  |  _ |  j rZ | j j d d  ƒ |  _ | j d ƒ |  _ n  d  S(   NR   s   cache/stepwiseR   (	   R   t   getvaluet   activet   Nonet   sessiont   cachet   gett
   lastfailedt   skip(   t   selfR   (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   __init__   s    			c         C   s   | |  _  d  S(   N(   R   (   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_sessionstart%   s    c         C   sÎ   |  j  s d  S|  j s# d |  _ d  Sg  } t } x7 | D]/ } | j |  j k rX t } Pq6 | j | ƒ q6 W| s d |  _ g  } n d j t | ƒ ƒ |  _ x | D] } | j	 | ƒ q  W| j
 j d | ƒ d  S(   Ns)   no previously failed tests, not skipping.s/   previously failed test not found, not skipping.s!   skipping {} already passed items.t   items(   R   R   t   report_statust   Falset   nodeidt   Truet   appendt   formatt   lent   removet   hookt   pytest_deselected(   R   R   R   R   t   already_passedt   foundt   item(    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_collection_modifyitems(   s(    					c         C   s%   |  j  r! | j r! d |  j _ n  d  S(   Ns4   Error when collecting test, stopping test execution.(   R   t   failedR   t
   shouldstop(   R   t   report(    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_collectreportI   s    c         C   s¨   |  j  s d | j k r d  S| j rt |  j rY | j |  j k rM d  |  _ n  t |  _ q¤ | j |  _ d |  j _	 n0 | j
 d k r¤ | j |  j k r¤ d  |  _ q¤ n  d  S(   Nt   xfails0   Test failed, continuing from this test next run.t   call(   R   t   keywordsR,   R   R    R   R   R   R   R-   t   when(   R   R.   (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_runtest_logreportO   s    		c         C   s0   |  j  r, |  j j d ƒ d k r, d |  j Sd  S(   Nt   verbosei    s   stepwise: %s(   R   R   t	   getoptionR   (   R   (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_report_collectionfinishj   s    !c         C   s?   |  j  r% |  j j j d |  j ƒ n |  j j j d g  ƒ d  S(   Ns   cache/stepwise(   R   R   R   t   setR   (   R   R   (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   pytest_sessionfinishn   s    	(	   t   __name__t
   __module__R   R   R+   R/   R4   R7   R9   (    (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyR      s   				!			(    (   t   pytestR   t   hookimplR   R   (    (    (    s/   lib/python2.7/site-packages/_pytest/stepwise.pyt   <module>   s   	