
    ?g                        S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr  SrSS	 jrSS
 jrSS jr " S S5      rg)    )annotations)nodes)Cache)Config)Parser)Session)
TestReportzcache/stepwisec           	     v    U R                  S5      nUR                  SSSSSSS9  UR                  S	S
SSSSS9  g )Ngeneralz--swz
--stepwise
store_trueFstepwisezBExit on test failure and continue from last failing test next time)actiondefaultdesthelpz	--sw-skipz--stepwise-skipstepwise_skipz_Ignore the first failing test but stop on the next failing test. Implicitly enables --stepwise.)getgroup	addoption)parsergroups     2/usr/lib/python3/dist-packages/_pytest/stepwise.pypytest_addoptionr      sZ    OOI&E	OOQ   
OO)      c                    U R                   R                  (       a  SU R                   l        U R                  S5      (       a&  U R                  R                  [        U 5      S5        g g )NTr   stepwiseplugin)optionr   r   	getoptionpluginmanagerregisterStepwisePlugin)configs    r   pytest_configurer"   #   sM    }}""!%
##%%nV&<>NO $r   c                   U R                   R                  S5      (       d`  U R                   R                  c   e[        U R                   S5      (       a  g U R                   R                  R	                  [
        / 5        g g )Nr   workerinput)r!   r   cachehasattrsetSTEPWISE_CACHE_DIRsessions    r   pytest_sessionfinishr+   +   sc    >>##J//~~##///7>>=11   !3R8 0r   c                  \    \ rS rSrS
S jrSS jr      SS jrSS jrSS jrSS jr	Sr
g	)r    6   c                    Xl         S U l        SU l        UR                  c   eUR                  U l        U R                  R	                  [
        S 5      U l        UR                  S5      U l        g )N r   )	r!   r*   report_statusr%   getr(   
lastfailedr   skip)selfr!   s     r   __init__StepwisePlugin.__init__7   sZ    '+||'''"LL
&*jjnn5G&N **?;	r   c                    Xl         g )Nr)   )r4   r*   s     r   pytest_sessionstart"StepwisePlugin.pytest_sessionstart@   s    r   c                   U R                   (       d  SU l        g S n[        U5       H#  u  pEUR                  U R                   :X  d  M!  Un  O   Uc  SU l        g SU S3U l        US U nUS U2	 UR                  R                  US9  g )Nz)no previously failed tests, not skipping.z/previously failed test not found, not skipping.z	skipping z already passed items.)items)r2   r0   	enumeratenodeidhookpytest_deselected)r4   r!   r;   failed_indexindexitem
deselecteds          r   pytest_collection_modifyitems,StepwisePlugin.pytest_collection_modifyitemsC   s     !LD $U+KE{{doo-$ , !RD#,\N:P!QD}-Jm|m$KK))
);r   c                d   UR                   (       al  U R                  (       a)  UR                  U R                  :X  a  S U l        SU l        g UR                  U l        U R                  c   eSU R                  l        g UR                  S:X  a#  UR                  U R                  :X  a  S U l        g g g )NFz0Test failed, continuing from this test next run.call)failedr3   r=   r2   r*   
shouldstopwhen)r4   reports     r   pytest_runtest_logreport'StepwisePlugin.pytest_runtest_logreport[   s    ==yy ==DOO3&*DO!	 #)--||///F ' {{f$==DOO3&*DO 4 %r   c                    U R                   R                  5       S:  a   U R                  (       a  SU R                   3$ g )Nr   z
stepwise: )r!   get_verbosityr0   r4   s    r   pytest_report_collectionfinish-StepwisePlugin.pytest_report_collectionfinishs   s6    ;;$$&!+0B0B 2 2344r   c                    [        U R                  S5      (       a  g U R                  R                  [        U R
                  5        g )Nr$   )r&   r!   r%   r'   r(   r2   rP   s    r   r+   #StepwisePlugin.pytest_sessionfinishx   s/    4;;.. 

)4??;r   )r%   r!   r2   r0   r*   r3   Nr!   r   returnNoner*   r   rV   rW   )r!   r   r;   zlist[nodes.Item]rV   rW   )rK   r	   rV   rW   )rV   z
str | None)rV   rW   )__name__
__module____qualname____firstlineno__r5   r8   rD   rL   rQ   r+   __static_attributes__ r   r   r    r    6   s8    <<<%5<	<0+0
<r   r    N)r   r   rV   rW   rU   rX   )
__future__r   _pytestr   _pytest.cacheproviderr   _pytest.configr   _pytest.config.argparsingr   _pytest.mainr   _pytest.reportsr	   r(   r   r"   r+   r    r^   r   r   <module>rf      s>    "  ' ! ,   & & *P9G< G<r   