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__/runner.cpython-310.pyc
o

%weH�
@s�dZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)dd l&m*Z*ej+dd!�d"kr�dd#l,m-Z-er�dd$l.m/Z/dd%l0m1Z1dd&l2m3Z3d'ed(dfd)d*�Z4dbd-d.�Z5dcd1d2�Z6dcd3d4�Z7d5e$d6ee$d(e8fd7d8�Z9	ddd5e$d:e8d6ee$d(e
efd;d<�Z:d5e$d(dfd=d>�Z;d5e$d(dfd?d@�Z<d5e$d(dfdAdB�Z=d5e$d6ee$d(dfdCdD�Z>d5e$dEedFd(dfdGdH�Z?dIed(eee@e@e@ffdJdK�ZA	9ded5e$dEdFd:e8d(efdLdM�ZBdNdOdIed(e8fdPdQ�ZCd5e$dEdFd(dRfdSdT�ZDedUd9dV�ZEeejFGdWdX�dXe	eE���ZGd5e$dNeGdd(efdYdZ�ZHd[e#d(efd\d]�ZIGd^d_�d_�ZJd[e#d(efd`da�ZKdS)fz3Basic collect and runtest protocol implementations.�N)�Callable)�cast)�Dict)�Generic)�List)�Optional)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union�)�
BaseReport)�CollectErrorRepr)�
CollectReport)�
TestReport)�timing)�ExceptionChainRepr)�
ExceptionInfo)�TerminalRepr)�final)�Parser)�check_ispytest)�	Collector)�Item)�Node)�Exit)�OutcomeException)�Skipped)�TEST_OUTCOME�)��)�BaseExceptionGroup)�Literal)�Session)�TerminalReporter�parser�returncCs@|jdddd�}|jddtdddd	�|jd
dtdddd	�dS)
Nzterminal reporting�	Reporting�general)�afterz--durations�store�Nz1Show N slowest setup/test durations (N=0 for all))�action�type�default�metavar�helpz--durations-ming{�G�zt?zJMinimal duration in seconds for inclusion in slowest list. Default: 0.005.)�getgroup�	addoption�int�float)r'�group�r8�G/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/runner.py�pytest_addoption2s"�
�r:�terminalreporterr&c	Cs |jjj}|jjj}|j�d�}|durdS|}g}|j��D]}|D]}t|d�r/|�|�q#q|s5dS|j	dd�dd�|sG|�
dd�n|�
dd	|�|d|�}t|�D]4\}}|d
kr{|j|kr{|�
d�|�
dt|�||f�dS|�
|jd
�d|jd�d|j���qYdS)N�verbose�durationcSs|jS�N)r=)�xr8r8r9�<lambda>Usz)pytest_terminal_summary.<locals>.<lambda>T)�key�reverse�=zslowest durationszslowest %s durationsr �z>(%s durations < %gs hidden.  Use -vv to show these durations.)z02.2fzs z<8� )�config�option�	durations�
durations_min�getvalue�stats�values�hasattr�append�sort�	write_sep�	enumerater=�
write_line�len�when�nodeid)	r;rHrIr<�tr�dlist�replist�rep�ir8r8r9�pytest_terminal_summaryGs>



��
��&�r[�sessionr%cCst�|_dSr>)�
SetupState�_setupstate�r\r8r8r9�pytest_sessionstartg�r`cCs|j�d�dSr>)r^�teardown_exactr_r8r8r9�pytest_sessionfinishksrc�item�nextitemcCs:|j}|j|j|jd�t||d�|j|j|jd�dS)N)rU�location�reT)�ihook�pytest_runtest_logstartrUrf�runtestprotocol�pytest_runtest_logfinish)rdrerhr8r8r9�pytest_runtest_protocolos
rlT�logcCs�t|d�}|r|js|��t|d|�}|g}|jr5|j�dd�r%t|�|j�dd�s5|�t|d|��|�t|d||d��|rHd|_d|_	|S)	N�_request�setup�	setupshowF�	setuponly�call�teardownrg)
rMrn�_initrequest�call_and_report�passedrF�	getoption�show_test_itemrN�funcargs)rdrmre�
hasrequestrY�reportsr8r8r9rjws

rjcCs^|j��}|��|�d�|�|j�tt|dg��}|r)|�d�d�|���|�	�dS)zAShow test function, parameters and the fixtures of the test item.z        �fixturenamesz (fixtures used: {})z, N)
rF�get_terminal_writer�line�writerU�sorted�getattr�format�join�flush)rd�tw�
used_fixturesr8r8r9rx�s

rxcCst|d�|jj�|�dS)Nro)�_update_current_test_varr\r^ro)rdr8r8r9�pytest_runtest_setup�s
r�c
Cs�t|d�zt`t`t`Wn	tyYnwz|��WdSty@}zt|�t_|t_|j	dus5J�|j	j
t_|�d}~ww)Nrr)r��sys�	last_type�
last_value�last_traceback�AttributeError�runtest�	Exceptionr/�
__traceback__�tb_next)rd�er8r8r9�pytest_runtest_call�s$
�

��r�cCs&t|d�|jj�|�t|d�dS)Nrs)r�r\r^rb)rdrer8r8r9�pytest_runtest_teardown�s
r�rTz$Literal['setup', 'call', 'teardown']cCsDd}|r|j�d|�d�}|�dd�}|tj|<dStj�|�dS)z�Update :envvar:`PYTEST_CURRENT_TEST` to reflect the current item and stage.

    If ``when`` is None, delete ``PYTEST_CURRENT_TEST`` from the environment.
    �PYTEST_CURRENT_TESTz (�)�z(null)N)rU�replace�os�environ�pop)rdrT�var_name�valuer8r8r9r��sr��reportcCs&|jdvr|jr
dS|jrdSdSdS)N)rors)�error�E�ERROR)�skipped�s�SKIPPED)rDrDrD)rT�failedr��r�r8r8r9�pytest_report_teststatus�s
r�cKsTt||fi|��}|j}|j||d�}|r|j|d�t||�r(|j|||d�|S)N�rdrrr���noderrr�)�call_runtest_hookrh�pytest_runtest_makereport�pytest_runtest_logreport�check_interactive_exception�pytest_exception_interact)rdrTrm�kwdsrr�hookr�r8r8r9ru�s
rurrzCallInfo[object]cCs8|jdurdSt|d�rdSt|jjttjf�rdSdS)zVCheck whether the call raised an exception that should be reported as
    interactive.NF�wasxfailT)�excinforM�
isinstancer�r�bdb�BdbQuit)rrr�r8r8r9r��s

r�zCallInfo[None]cs~|dkr	�jj�n|dkr�jj�n|dkr�jj�nJd|����tf}�j�dd�s1|tf7}tj	���fdd�||d	�S)
NrorrrsFzUnhandled runtest hook case: �usepdbcs�dd�i���S)Nrdr8r8r8�rhrdr�r8r9r@sz#call_runtest_hook.<locals>.<lambda>)rT�reraise)
rhr�r�r�rrFrw�KeyboardInterrupt�CallInfo�	from_call)rdrTr�r�r8r�r9r��s



�r��TResult)�	covariantc@s�eZdZUdZeeed<eeeed<e	ed<e	ed<e	ed<ded<d	d
�deedeeede	de	de	ddde
d
dfdd�Zed
efdd��Z
e	ddddddeeeeeeedffd
dfdd��Zd
efdd�ZdS)r�z/Result/Exception info of a function invocation.�_resultr��start�stopr=z/Literal['collect', 'setup', 'call', 'teardown']rTF)�	_ispytest�resultr�r(NcCs0t|�||_||_||_||_||_||_dSr>)rr�r�r�r�r=rT)�selfr�r�r�r�r=rTr�r8r8r9�__init__s
zCallInfo.__init__cCs$|jdurt|�d���tt|j�S)zlThe return value of the call, if it didn't raise.

        Can only be accessed if excinfo is None.
        Nz has no valid result)r�r�rr�r��r�r8r8r9r�1s
zCallInfo.result�funczCallable[[], TResult]r�.zCallInfo[TResult]c	Cs�d}t��}t��}z|�}Wnty)t��}|dur%t|j|�r%�d}Ynwt��}||}	t��}
|||
|	|||dd�S)avCall func, wrapping the result in a CallInfo.

        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        NT)r�r�r=rTr�r�r�)r�time�perf_counter�
BaseExceptionr�from_currentr�r�)�clsr�rTr�r�r��
precise_startr��precise_stopr=r�r8r8r9r�>s.
��zCallInfo.from_callcCs6|jdurd|j�d|j�d�Sd|j�d|j�d�S)Nz<CallInfo when=z	 result: �>z	 excinfo=)r�rTr�r�r8r8r9�__repr__is
zCallInfo.__repr__r>)�__name__�
__module__�__qualname__�__doc__rr��__annotations__rr�r6�boolr��propertyr��classmethodrr	rr��strr�r8r8r8r9r�
sT
��
�����	�

�������*r�cCst�||�Sr>)r�from_item_and_callr�r8r8r9r�orar��	collectorcst��fdd�d�}d}|jsd}n\tg}tj�d�}|dur%|�|j�t	|jj
t|��rTd}��|jd�}t	|t
�sBJt|���|j}|sIJ�t|j�|j|jf}nd}��|j�}t|d	�slt	|t�shJ�t|�}|}|jst|jnd}	t�j|||	�}
||
_|
S)
Ncst����Sr>)�list�collectr8�r�r8r9r@tsz,pytest_make_collect_report.<locals>.<lambda>r�rv�unittestr�r~r��
toterminal)r�r�r�rr��modules�getrN�SkipTestr�r��tuple�_repr_failure_pyr�repr�	reprcrashr��path�lineno�message�repr_failurerMrr�rrUrr)r�rr�longrepr�outcome�skip_exceptionsr��r_�r�	errorinfor�rYr8r�r9�pytest_make_collect_reportss2
r�c@s`eZdZdZddd�Zdeddfdd�Zd	egefd
e	ddfdd�Z
d
eeddfdd�ZdS)r]aEShared state for setting up/tearing down test items or collectors
    in a session.

    Suppose we have a collection tree as follows:

    <Session session>
        <Module mod1>
            <Function item1>
        <Module mod2>
            <Function item2>

    The SetupState maintains a stack. The stack starts out empty:

        []

    During the setup phase of item1, setup(item1) is called. What it does
    is:

        push session to stack, run session.setup()
        push mod1 to stack, run mod1.setup()
        push item1 to stack, run item1.setup()

    The stack is:

        [session, mod1, item1]

    While the stack is in this shape, it is allowed to add finalizers to
    each of session, mod1, item1 using addfinalizer().

    During the teardown phase of item1, teardown_exact(item2) is called,
    where item2 is the next item to item1. What it does is:

        pop item1 from stack, run its teardowns
        pop mod1 from stack, run its teardowns

    mod1 was popped because it ended its purpose with item1. The stack is:

        [session]

    During the setup phase of item2, setup(item2) is called. What it does
    is:

        push mod2 to stack, run mod2.setup()
        push item2 to stack, run item2.setup()

    Stack:

        [session, mod2, item2]

    During the teardown phase of item2, teardown_exact(None) is called,
    because item2 is the last item. What it does is:

        pop item2 from stack, run its teardowns
        pop mod2 from stack, run its teardowns
        pop session from stack, run its teardowns

    Stack:

        []

    The end!
    r(NcCs
i|_dSr>)�stackr�r8r8r9r��s
�zSetupState.__init__rdcCs�|��}|j��D]\}\}}||vsJd��|r|�q	|t|j�d�D]2}||jvs.J�|jgdf|j|<z|��Wq%tyW}z|j|d|f|j|<|�d}~wwdS)z4Setup objects along the collector chain to the item.z(previous item was not torn down properlyNr)�	listchainr��itemsrSrsror)r�rd�needed_collectors�col�
finalizers�excr8r8r9ro�s"����zSetupState.setup�	finalizerr�cCsN|rt|t�r	J�t|�sJ�||jvsJ||jf��|j|d�|�dS)zgAttach a finalizer to the given node.

        The node must be currently active in the stack.
        rN)r�r��callabler�rN)r�r�r�r8r8r9�addfinalizer�szSetupState.addfinalizerrec
Cs(|r|��pg}g}|jrqt|j���|dt|j��krnS|j��\}\}}g}|rN|��}z|�WntyK}	z|�|	�WYd}	~	nd}	~	ww|s+t|�dkrZ|�	|�n|rnd|��}
|�t
|
|ddd���|js
t|�dkr{|d�|r�t
d|ddd���|dur�|jr�J�dSdS)z�Teardown the current stack up until reaching nodes that nextitem
        also descends from.

        When nextitem is None (meaning we're at the last item), the entire
        stack is torn down.
        Nr
zerrors while tearing down ���rzerrors during test teardown)r�r�r��keysrS�popitemr�rrN�extendr#)r�rer��
exceptionsr�r��_�these_exceptions�finr��msgr8r8r9rb�s< 
���
�
�zSetupState.teardown_exact)r(N)
r�r�r�r�r�rror�objectrr�rrbr8r8r8r9r]�s
?
r]cCsN|j}|j|d�|j|d�}|j�dd�}|r%t||�r%|j|||d�|S)Nr�rrr�)rh�pytest_collectstartr��__dict__r�r�r�)r�rhrYrrr8r8r9�collect_one_node sr	)r;r&r(N)r\r%r(N)TN)T)Lr�r��dataclassesr�r��typingrrrrrrrr	r
rrr{rrrr�_pytestr�_pytest._code.coderrr�_pytest.compatr�_pytest.config.argparsingr�_pytest.deprecatedr�
_pytest.nodesrrr�_pytest.outcomesrrrr�version_info�exceptiongroupr#�typing_extensionsr$�_pytest.mainr%�_pytest.terminalr&r:r[r`rcr�rlrjrxr�r�r�r�r�r�rur�r�r��	dataclassr�r�r�r]r	r8r8r8r9�<module>s�

 
	����
���
� ����
�
��
�`