HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/_pytest/__pycache__/stepwise.cpython-310.pyc
o

%wej�@s�ddlmZddlmZddlmZddlZddlmZddlmZddl	m
Z
ddlmZdd	l
mZer<dd
lmZdZde
d
dfdd�Zejded
dfdd��Zded
dfdd�ZGdd�d�ZdS)�)�List)�Optional)�
TYPE_CHECKINGN)�nodes)�Config)�Parser)�Session)�
TestReport)�Cachezcache/stepwise�parser�returncCs:|�d�}|jddddddd�|jd	d
ddddd�dS)
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)r�group�r�I/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/stepwise.py�pytest_addoptions"
�
�r�configcCs4|jjrd|j_|�d�r|j�t|�d�dSdS)NTr�stepwiseplugin)�optionrr�	getoption�
pluginmanager�register�StepwisePlugin)rrrr�pytest_configure's

�r"�sessioncCsD|j�d�s |jjdusJ�t|jd�rdS|jj�tg�dSdS)Nr�workerinput)rr�cache�hasattr�set�STEPWISE_CACHE_DIR�r#rrr�pytest_sessionfinish0s�r*c@szeZdZdeddfdd�Zdeddfdd�Zded	eej	ddfd
d�Z
deddfd
d�Zde
efdd�Zddd�ZdS)r!rrNcCsH||_d|_d|_|jdusJ�|j|_|j�td�|_|�d�|_dS)N�r)	rr#�
report_statusr%�getr(�
lastfailedr�skip)�selfrrrr�__init__<szStepwisePlugin.__init__r#cCs
||_dS)Nr))r0r#rrr�pytest_sessionstartEs
z"StepwisePlugin.pytest_sessionstart�itemscCs�|jsd|_dSd}t|�D]\}}|j|jkr|}nq|dur&d|_dSd|�d�|_|d|�}|d|�=|jj|d�dS)Nz)no previously failed tests, not skipping.z/previously failed test not found, not skipping.z	skipping z already passed items.)r3)r.r,�	enumerate�nodeid�hook�pytest_deselected)r0rr3�failed_index�index�item�
deselectedrrr�pytest_collection_modifyitemsHs�

z,StepwisePlugin.pytest_collection_modifyitems�reportcCsr|jr%|jr|j|jkrd|_d|_dS|j|_|jdusJ�d|j_dS|jdkr5|j|jkr7d|_dSdSdS)NFz0Test failed, continuing from this test next run.�call)�failedr/r5r.r#�
shouldstop�when)r0r=rrr�pytest_runtest_logreport`s

�

�z'StepwisePlugin.pytest_runtest_logreportcCs&|j�d�dkr|jrd|j��SdS)N�verboserz
stepwise: )rrr,�r0rrr�pytest_report_collectionfinishxsz-StepwisePlugin.pytest_report_collectionfinishcCs$t|jd�rdS|j�t|j�dS)Nr$)r&rr%r'r(r.rDrrrr*}sz#StepwisePlugin.pytest_sessionfinish)rN)�__name__�
__module__�__qualname__rr1rr2rr�Itemr<r	rBr�strrEr*rrrrr!;s	��
�r!)�typingrrr�pytest�_pytestr�_pytest.configr�_pytest.config.argparsingr�_pytest.mainr�_pytest.reportsr	�_pytest.cacheproviderr
r(r�hookimplr"r*r!rrrr�<module>s"