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

%wehQ�@s�ddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl$m%Z%dd l&m'Z'dd!l&m(Z(dd"l)m*Z*er�dd#l+m,Z,dd$l-m.Z.d%d&�Z/ed'd(d)�Z0Gd*d(�d(�Z1d+e2d,ee1d-e
fd.d/�Z3e#Gd0d1�d1e1��Z4e#Gd2d3�d3e1��Z5Gd4d5�d5e�Z6d6ee5e4fd-eee2effd7d8�Z7d9ee2efd-eee5e4ffd:d;�Z8d6e1d-ee2effd<d=�Z9d>ee2efd-ee2effd?d@�Z:dS)A�N)�StringIO)�pprint)�Any)�cast)�Dict)�Iterable)�Iterator)�List)�Mapping)�NoReturn)�Optional)�Tuple)�Type)�
TYPE_CHECKING)�TypeVar)�Union)�ExceptionChainRepr)�
ExceptionInfo)�
ExceptionRepr)�	ReprEntry)�ReprEntryNative)�ReprExceptionInfo��ReprFileLocation)�ReprFuncArgs)�
ReprLocals��
ReprTraceback)�TerminalRepr)�TerminalWriter)�final)�Config)�	Collector)�Item)�skip)�Literal)�CallInfoc
Cs\z|jWSty-|j}d|ddd�}d�|d|d||d�|_}|YSw)Nz%s.%s.%s�version_info�z[{}] {} -- Python {} {}�id�sysplatform�
executable)�_workerinfocache�AttributeError�
workerinfo�format)�node�d�ver�s�r4�H/home/arjun/projects/env/lib/python3.10/site-packages/_pytest/reports.py�getworkerinfoline,s
��r6�_R�
BaseReport)�boundc@s�eZdZUeeed<eeeeeefed<ede	e
eeeefeefed<eeeefed<eed<ded<d	e
d
dfdd�ZerPd
ed
e
fdd�Zded
dfdd�Zded
eeeeffdd�Zed
efdd��Zed
efdd��Zed
efdd��Zed
efdd��Zed
efdd��Zed
efd d!��Zed
efd"d#��Zed
efd$d%��Zed
efd&d'��Zed
eefd(d)��Z d*e!fd+d,�Z"d
e#ee
ffd-d.�Z$e%d/e&e'd0e#ee(fd
e'fd1d2��Z)dS)3r8�when�locationN�longrepr�sections�nodeid�&Literal['passed', 'failed', 'skipped']�outcome�kw�returncKs|j�|�dS�N)�__dict__�update)�selfrAr4r4r5�__init__EszBaseReport.__init__�keycCsdSrCr4)rFrHr4r4r5�__getattr__JszBaseReport.__getattr__�outcCs�t|d�rt|j�}|r|�|�|j}|durdSt|d�r+tt|�}|�|�dSzt|�}Wnt	y<d}Ynw|�|�dS)Nr0�
toterminalz<unprintable longrepr>)
�hasattrr6r0�liner<rrrK�str�UnicodeEncodeError)rFrJ�worker_infor<�longrepr_terminalr3r4r4r5rKMs 




�zBaseReport.toterminal�prefixccs*�|jD]\}}|�|�r||fVqdSrC)r=�
startswith)rFrR�name�contentr4r4r5�get_sectionsas�

��zBaseReport.get_sectionscCs.t�}t|�}d|_|�|�|��}|��S)zRead-only property that returns the full string representation of
        ``longrepr``.

        .. versionadded:: 3.0
        F)rr�	hasmarkuprK�getvalue�strip)rF�file�tw�excr4r4r5�longreprtextfs
zBaseReport.longreprtextcC�d�dd�|�d�D��S)z_Return captured log lines, if log capturing is enabled.

        .. versionadded:: 3.5
        �
cs��|]\}}|VqdSrCr4��.0rRrUr4r4r5�	<genexpr>z��
�z$BaseReport.caplog.<locals>.<genexpr>zCaptured log��joinrV�rFr4r4r5�caplogt�
�zBaseReport.caplogcCr^)zbReturn captured text from stdout, if capturing is enabled.

        .. versionadded:: 3.0
        �csr`rCr4rar4r4r5rc�rdz'BaseReport.capstdout.<locals>.<genexpr>zCaptured stdoutrergr4r4r5�	capstdout~rizBaseReport.capstdoutcCr^)zbReturn captured text from stderr, if capturing is enabled.

        .. versionadded:: 3.0
        rjcsr`rCr4rar4r4r5rc�rdz'BaseReport.capstderr.<locals>.<genexpr>zCaptured stderrrergr4r4r5�	capstderr�rizBaseReport.capstderrcC�
|jdkS)zWhether the outcome is passed.�passed�r@rgr4r4r5rn��
zBaseReport.passedcCrm)zWhether the outcome is failed.�failedrorgr4r4r5rq�rpzBaseReport.failedcCrm)zWhether the outcome is skipped.�skippedrorgr4r4r5rr�rpzBaseReport.skippedcCs|j�d�dS)z3The path portion of the reported node, as a string.z::r)r>�splitrgr4r4r5�fspath�szBaseReport.fspathcCsdS)a6**Experimental** Whether this report should be counted towards the
        totals shown at the end of the test session: "1 passed, 1 failure, etc".

        .. note::

            This function is considered **experimental**, so beware that it is subject to changes
            even in patch releases.
        Tr4rgr4r4r5�count_towards_summary�s
z BaseReport.count_towards_summarycCs|jdur
|j\}}}|SdS)a�**Experimental** The head line shown with longrepr output for this
        report, more commonly during traceback representation during
        failures::

            ________ Test.foo ________


        In the example above, the head_line is "Test.foo".

        .. note::

            This function is considered **experimental**, so beware that it is subject to changes
            even in patch releases.
        N)r;)rFrt�lineno�domainr4r4r5�	head_line�s
zBaseReport.head_line�configcCs|jj||d�\}}}|S)N)�reportry)�hook�pytest_report_teststatus)rFry�	_category�_short�verboser4r4r5�_get_verbose_word�s�zBaseReport._get_verbose_wordcCst|�S)z�Return the contents of this report as a dict of builtin entries,
        suitable for serialization.

        This was originally the serialize_report() function from xdist (ca03269).

        Experimental method.
        )�_report_to_jsonrgr4r4r5�_to_json�szBaseReport._to_json�cls�
reportdictcCst|�}|di|��S)aCreate either a TestReport or CollectReport, depending on the calling class.

        It is the callers responsibility to know which class to pass here.

        This was originally the serialize_report() function from xdist (ca03269).

        Experimental method.
        Nr4)�_report_kwargs_from_json)r�r��kwargsr4r4r5�
_from_json�s
zBaseReport._from_json)*�__name__�
__module__�__qualname__rrN�__annotations__r
�intrr�
BaseExceptionrr	rrGrrIrrKrrV�propertyr]rhrkrl�boolrnrqrrrtrurxr!r�rr��classmethodrr7�objectr�r4r4r4r5r8;sL
�
			
(�	type_name�report_classrBcCsjd}t�}td|d�td||d�td||d�t||d�td||d�td|d�t|����)Nz+https://github.com/pytest-dev/pytest/issueszd----------------------------------------------------------------------------------------------------)�streamz.INTERNALERROR: Unknown entry type returned: %szreport_name: %szPlease report this bug at %s)rr�RuntimeErrorrX)r�r�r��urlr�r4r4r5�_report_unserialization_failure�sr�c@s�eZdZdZdZ					ddedeeeeefde	ee
fd	d
dedee
eeeefeefdd
deeeefdedededeeeeefddfdd�Zdefdd�Zededdddfdd��ZdS)�
TestReportz�Basic test report object (also used for setup and teardown calls if
    they fail).

    Reports can contain arbitrary extra attributes.
    Fr4rNr>r;�keywordsr@r?r<r:z$Literal['setup', 'call', 'teardown']r=�duration�start�stop�user_propertiesrBc
Ks^||_||_||_||_||_||_t|pg�|_t|�|_||_	|	|_
|
|_|j�
|�dSrC)r>r;r�r@r<r:�listr�r=r�r�r�rDrE)
rFr>r;r�r@r<r:r=r�r�r�r��extrar4r4r5rG�s
zTestReport.__init__cCsd�|jj|j|j|j�S)Nz <{} {!r} when={!r} outcome={!r}>)r/�	__class__r�r>r:r@rgr4r4r5�__repr__9s�zTestReport.__repr__�item�callzCallInfo[None]c
Csd|j}|dks	J�|j}|j}|j}dd�|jD�}|j}g}	|js'd}
d}nct|t�s1d}
|}nYt|jt	j
�rqd}
|��}|dusFJd��|jjrf|�
�dd	�\}
}|dusZJ�t�|
�|d
|jf}n$t|j�|j|jf}nd}
|jdkr~|�|�}n|j||j�dd
�d�}|jD]\}}}|	�d|�d|��|f�q�||j|j||
|||	||||jd�S)z�Create and fill a TestReport with standard item and call info.

        :param item: The item.
        :param call: The call info.
        �collectcSsi|]}|d�qS)�r4�rb�xr4r4r5�
<dictcomp>Ksz1TestReport.from_item_and_call.<locals>.<dictcomp>rnNrqrrz=There should always be a traceback entry for skipping a test.�r�r��tbstyle�auto)�stylez	Captured � )r�)r:r�r�r�r��excinfo�
isinstancer�valuer$�	Exception�
_getreprcrash�_use_item_location�
reportinfo�osrt�messagerN�pathrv�repr_failure�_repr_failure_pyry�	getoption�_report_sections�appendr>r;r�)r�r�r�r:r�r�r�r�r�r=r@r<�rr�rM�rwhenrHrUr4r4r5�from_item_and_call>s^�

�
��zTestReport.from_item_and_call)r4rrrN)r�r�r��__doc__�__test__rNr
rr�r
rrrr�rr�floatr�rGr�r�r#r�r4r4r4r5r��sL���
����	�
���
��
�<r�c@s�eZdZdZdZ	ddedddedeee	ee
efeefd	ee
eeefd
ee	eefddfdd
�Zedee	eee
effdd��Zdefdd�ZdS)�
CollectReportzSCollection report object.

    Reports can contain arbitrary extra attributes.
    r�r4r>r@r?r<N�resultr=rBcKs6||_||_||_|pg|_t|�|_|j�|�dSrC)r>r@r<r�r�r=rDrE)rFr>r@r<r�r=r�r4r4r5rG�s

zCollectReport.__init__cCs|jd|jfSrC)rtrgr4r4r5r;�szCollectReport.locationcCsd�|jt|j�|j�S)Nz.<CollectReport {!r} lenresult={} outcome={!r}>)r/r>�lenr�r@rgr4r4r5r��s�zCollectReport.__repr__)r4)r�r�r�r�r:rNrrr�r
r�rrr	r#r"rrGr�r;r�r4r4r4r5r��s0
�������

��r�c@s0eZdZdeddfdd�Zdeddfdd�ZdS)	�CollectErrorRepr�msgrBNcCs
||_dSrC)r<)rFr�r4r4r5rG�s
zCollectErrorRepr.__init__rJcCs|j|jdd�dS)NT)�red)rMr<)rFrJr4r4r5rK�szCollectErrorRepr.toterminal)r�r�r�rNrGrrKr4r4r4r5r��sr�rzcCs*t|ttf�r|��}|jj|d<|SdS)N�$report_type)r�r�r�r�r�r�)rz�datar4r4r5�pytest_report_to_serializable�s
r�r�cCsJd|vr#|ddkrt�|�S|ddkrt�|�SJd�|d���dS)Nr�r�r�Fz(Unknown report_type unserialize data: {})r�r�r�r/)r�r4r4r5�pytest_report_from_serializable�s

�r�csdtttfdtttffdd��dtdtttff�fdd��dttdttttffd	d
��dt	dtttff��fdd
�}|j
��}t|j
d�rgt|j
d�r_t|j
d�r_||�|d<n
t|j
�|d<n|j
|d<|D]}t||tj�r�t�||�||<qn|dkr�d||<qn|S)z�Return the contents of this report as a dict of builtin entries,
    suitable for serialization.

    This was originally the serialize_report() function from xdist (ca03269).
    �entryrBcSsHt�|�}|��D]\}}t|d�rt�|�||<q	t|�j|d�}|S)NrD)�typer�)�dataclasses�asdict�itemsrLr�r�)r�r�rHr��
entry_datar4r4r5�serialize_repr_entry�s

�z-_report_to_json.<locals>.serialize_repr_entry�
reprtracebackcs&t�|�}�fdd�|jD�|d<|S)Nc�g|]}�|��qSr4r4r��r�r4r5�
<listcomp>���zE_report_to_json.<locals>.serialize_repr_traceback.<locals>.<listcomp>�reprentries)r�r�r�)r�r�r�r4r5�serialize_repr_traceback�s



�z1_report_to_json.<locals>.serialize_repr_traceback�	reprcrashcSs|dur	t�|�SdSrC)r�r�)r�r4r4r5�serialize_repr_crash�s
z-_report_to_json.<locals>.serialize_repr_crash�repcs�|jdusJ�tt|j�}�|j��|j�|jd�}t|t�r<g|d<|jD]\}}}|d�	�|��|�|f�q&|Sd|d<|S)N)r�r�r=�chain)
r<rrr�r�r=r�rr�r�)r�r<r��repr_traceback�
repr_crash�description)r�r�r4r5�serialize_exception_longrepr�s$�
��	�z5_report_to_json.<locals>.serialize_exception_longreprrKr<r�N)rrrrrNrrrrr8rD�copyrLr<r�r��PathLikert)rzr�r1rTr4)r�r�r�r5r��s6
�

�
�
� 
�
�r�r�cs��fdd���fdd�}dttttffdd�}�drvd	�dvrvd
�dvrv|�dd
�}|�dd	�}�ddr^g}�ddD]\}}}|�||�||�|f�qGt|�}	nt||d�}	�dd
D]}
|	j|
�qj|	�d<�S)z�Return **kwargs that can be used to construct a TestReport or
    CollectReport instance.

    This was originally the serialize_report() function from xdist (ca03269).
    cs�|d}|d}|dkrGd}d}d}|drtdi|d��}|dr,tdi|d��}|dr8t|dd�}t|d||||dd	�}|S|d
krSt|d�}|St|t��|S)Nr�r�r�reprfuncargs�reprfileloc�
reprlocals�linesr�)r�r�r�r�r�rr4)rrrrrr�r�)r�r��
entry_typer�r�r��	reprentry)r�r4r5�deserialize_repr_entry%s2���z8_report_kwargs_from_json.<locals>.deserialize_repr_entrycs(�fdd�|dD�|d<tdi|��S)Ncr�r4r4r��r�r4r5r�Ar�zP_report_kwargs_from_json.<locals>.deserialize_repr_traceback.<locals>.<listcomp>r�r4r)�repr_traceback_dictr�r4r5�deserialize_repr_traceback@s

�z<_report_kwargs_from_json.<locals>.deserialize_repr_traceback�repr_crash_dictcSs|durtdi|��SdS)Nr4r)r�r4r4r5�deserialize_repr_crashFsz8_report_kwargs_from_json.<locals>.deserialize_repr_crashr<r�r�r�)r�r�r=)rrrNrr�rr�
addsection)r�r�r�r�r�r��repr_traceback_data�repr_crash_datar��exception_info�sectionr4)r�r�r5r�sD�
�����	��r�);r�r��iorr�typingrrrrrr	r
rrr
rrrr�_pytest._code.coderrrrrrrrrrr�_pytest._ior�_pytest.compatr �_pytest.configr!�
_pytest.nodesr"r#�_pytest.outcomesr$�typing_extensionsr%�_pytest.runnerr&r6r7r8rNr�r�r�r�r�r�r�r�r4r4r4r5�<module>s�+��
�
3
�
�
�
�&I