
    yIfQ                     T   d dl Z d dlmZ d dlZd dlmZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 d d	lmZ d d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlm Z  d dlm!Z! d dl"m#Z# d d l$m%Z% d d!l&m'Z' d d"l&m(Z( d d#l)m*Z* erd d$l+m,Z, d% Z- ed&d'(          Z. G d) d'          Z/d*e0d+ee/         d,efd-Z1e	 G d. d/e/                      Z2e	 G d0 d1e/                      Z3 G d2 d3e!          Z4d4ee3e2f         d,eee0ef                  fd5Z5d6ee0ef         d,eee3e2f                  fd7Z6d4e/d,ee0ef         fd8Z7d9ee0ef         d,ee0ef         fd:Z8dS );    N)StringIO)pprint)Any)cast)Dict)final)Iterable)Iterator)List)Literal)Mapping)NoReturn)Optional)Tuple)Type)TYPE_CHECKING)TypeVar)Union)ExceptionChainRepr)ExceptionInfo)ExceptionRepr)	ReprEntry)ReprEntryNative)ReprExceptionInfoReprFileLocation)ReprFuncArgs)
ReprLocalsReprTraceback)TerminalRepr)TerminalWriter)Config)	Collector)Item)skip)CallInfoc                     	 | j         S # t          $ rU | j        } dj        |d         d d          }d                    |d         |d         ||d                   x| _         }|cY S w xY w)Nz{}.{}.{}version_info   z[{}] {} -- Python {} {}idsysplatform
executable)_workerinfocacheAttributeError
workerinfoformat)nodedverss       C/var/www/piapp/venv/lib/python3.11/site-packages/_pytest/reports.pygetworkerinfoliner7   -   s    $$   Oj>!22A2!67$=$D$DdGQ}%sAlO%
 %
 	
 s   	 AA('A(_R
BaseReport)boundc                      e Zd ZU ee         ed<   eeeee         ef                  ed<   ede	e
         eeeef         eef         ed<   eeeef                  ed<   eed<   ed         ed<   d	ed
dfdZerded
efdZded
dfdZded
eeeef                  fdZed
efd            Zed
efd            Zed
efd            Zed
efd            Zed
efd            Zed
efd            Zed
efd            Zed
efd            Zed
efd            Z ed
ee         fd            Z!de"fdZ#d
e$eef         fdZ%e&de'e(         d e$ee)f         d
e(fd!            Z*dS )"r9   whenlocationNlongreprsectionsnodeidpassedfailedskippedoutcomekwreturnc                 :    | j                             |           d S N)__dict__update)selfrF   s     r6   __init__zBaseReport.__init__F   s    R         keyc                     d S rI    )rL   rO   s     r6   __getattr__zBaseReport.__getattr__K   s      rN   outc                 z   t          | d          r+t          | j                  }|r|                    |           | j        }|d S t          |d          r,t          t          |          }|                    |           d S 	 t          |          }n# t          $ r d}Y nw xY w|                    |           d S )Nr2   
toterminalz<unprintable longrepr>)
hasattrr7   r2   liner>   r   r!   rU   strUnicodeEncodeError)rL   rS   worker_infor>   longrepr_terminalr5   s         r6   rU   zBaseReport.toterminalM   s    4   	&+DI66K &%%%=F8\** 	 $\8 < <((------MM% - - -,-HHQKKKKKs   B B#"B#prefixc              #   Z   K   | j         D ] \  }}|                    |          r||fV  !d S rI   )r?   
startswith)rL   r\   namecontents       r6   get_sectionszBaseReport.get_sectionsa   sJ      !] 	& 	&MD'v&& &go%%%	& 	&rN   c                     t                      }t          |          }d|_        |                     |           |                                }|                                S )zRead-only property that returns the full string representation of
        ``longrepr``.

        .. versionadded:: 3.0
        F)r   r"   	hasmarkuprU   getvaluestrip)rL   filetwexcs       r6   longreprtextzBaseReport.longreprtextf   sN     zzD!!mmooyy{{rN   c                 f    d                     d |                     d          D                       S )z_Return captured log lines, if log capturing is enabled.

        .. versionadded:: 3.5
        
c              3       K   | ]	\  }}|V  
d S rI   rQ   .0r\   r`   s      r6   	<genexpr>z$BaseReport.caplog.<locals>.<genexpr>z   s7       
 
)G
 
 
 
 
 
rN   zCaptured logjoinra   rL   s    r6   caplogzBaseReport.caplogt   sD     yy 
 
-1->->~-N-N
 
 
 
 
 	
rN   c                 f    d                     d |                     d          D                       S )zbReturn captured text from stdout, if capturing is enabled.

        .. versionadded:: 3.0
         c              3       K   | ]	\  }}|V  
d S rI   rQ   rm   s      r6   ro   z'BaseReport.capstdout.<locals>.<genexpr>   7       
 
)G
 
 
 
 
 
rN   zCaptured stdoutrp   rr   s    r6   	capstdoutzBaseReport.capstdout~   E     ww 
 
-1->->?P-Q-Q
 
 
 
 
 	
rN   c                 f    d                     d |                     d          D                       S )zbReturn captured text from stderr, if capturing is enabled.

        .. versionadded:: 3.0
        ru   c              3       K   | ]	\  }}|V  
d S rI   rQ   rm   s      r6   ro   z'BaseReport.capstderr.<locals>.<genexpr>   rw   rN   zCaptured stderrrp   rr   s    r6   	capstderrzBaseReport.capstderr   ry   rN   c                     | j         dk    S )zWhether the outcome is passed.rB   rE   rr   s    r6   rB   zBaseReport.passed        |x''rN   c                     | j         dk    S )zWhether the outcome is failed.rC   r~   rr   s    r6   rC   zBaseReport.failed   r   rN   c                     | j         dk    S )zWhether the outcome is skipped.rD   r~   rr   s    r6   rD   zBaseReport.skipped   s     |y((rN   c                 B    | j                             d          d         S )z3The path portion of the reported node, as a string.z::r   )r@   splitrr   s    r6   fspathzBaseReport.fspath   s     {  &&q))rN   c                     dS )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.
        TrQ   rr   s    r6   count_towards_summaryz BaseReport.count_towards_summary   s	     trN   c                 .    | j         | j         \  }}}|S dS )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=   )rL   r   linenodomains       r6   	head_linezBaseReport.head_line   s$      =$%)]"FFFMtrN   configc                 F    |j                             | |          \  }}}|S )N)reportr   )hookpytest_report_teststatus)rL   r   	_category_shortverboses        r6   _get_verbose_wordzBaseReport._get_verbose_word   s2    %+[%I%I &J &
 &
"	67 rN   c                      t          |           S )zReturn 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_jsonrr   s    r6   _to_jsonzBaseReport._to_json   s     t$$$rN   cls
reportdictc                 0    t          |          } | di |S )a  Create 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.
        rQ   )_report_kwargs_from_json)r   r   kwargss      r6   
_from_jsonzBaseReport._from_json   s#     **55s}}V}}rN   )+__name__
__module____qualname__r   rX   __annotations__r   intr   r   BaseExceptionr!   r   r   r   rM   r   rR   r"   rU   r
   ra   propertyri   rs   rx   r|   boolrB   rC   rD   r   r   r   r#   r   r   r   classmethodr   r8   objectr   rQ   rN   r6   r9   r9   <   sO        
3-uS(3-456666mM*E#sC-,@#|S    5c?####KKK23333!S !T ! ! ! !  433333333n     (&3 &8E#s(O+D & & & &
 c    X 
 
 
 
 X
 
3 
 
 
 X
 
3 
 
 
 X
 ( ( ( ( X( ( ( ( ( X( ) ) ) ) X) * * * * X* 	t 	 	 	 X	 8C=    X(    %$sCx. % % % % 
R 
d3;.? 
B 
 
 
 [
 
 
rN   	type_namereport_classrG   c                 B   d}t                      }t          d|           t          d| z  |           t          d|z  |           t          ||           t          d|z  |           t          d|           t          |                                          )Nz+https://github.com/pytest-dev/pytest/issueszd----------------------------------------------------------------------------------------------------)streamz.INTERNALERROR: Unknown entry type returned: %szreport_name: %szPlease report this bug at %s)r   r   RuntimeErrorrd   )r   r   r   urlr   s        r6   _report_unserialization_failurer      s     8CZZF
9V$$$$
;iGPVWWWW
|+F;;;;
:f%%%%
)C/????
9V$$$$
v((
)
))rN   c                   T   e Zd ZU dZdZeed<   	 	 	 	 	 ddedeeee	         ef         d	e
eef         d
ed         dedee         eee	ef         eef         ded         deeeef                  dedededeeeeef                           ddfdZdefdZededddd fd            ZdS )
TestReportzBasic test report object (also used for setup and teardown calls if
    they fail).

    Reports can contain arbitrary extra attributes.
    FwasxfailrQ   r   Nr@   r=   keywordsrE   rA   r>   r<   )setupcallteardownr?   durationstartstopuser_propertiesrG   c                    || _         || _        || _        || _        || _        || _        t          |pg           | _        t          |          | _        || _	        |	| _
        |
| _        | j                            |           d S rI   )r@   r=   r   rE   r>   r<   listr   r?   r   r   r   rJ   rK   )rL   r@   r=   r   rE   r>   r<   r?   r   r   r   r   extras                r6   rM   zTestReport.__init__   s    $  9A ,4  ! 	  $O$9r:: X  ( "
	U#####rN   c           	      R    d| j         j         d| j        d| j        d| j        d	S )N< z when=	 outcome=>)	__class__r   r@   r<   rE   rr   s    r6   __repr__zTestReport.__repr__<  s8    i4>*iiT[ii$)iiX\XdiiiirN   itemr   zCallInfo[None]c                 x   |j         }|dk    sJ |j        }|j        }|j        }d |j        D             }|j        }g }	|j        sd}
d}n t          |t                    sd}
|}nt          |j        t          j
                  rd}
|                                }|
J d            |j        j        rC|                                dd         \  }}|J t          j        |          |d	z   |j        f}nut#          |j                  |j        |j        f}nSd}
|j         d
k    r|                    |          }n0|                    ||j                            dd                    }|j        D ]#\  }}}|	                    d| d| |f           $ | |j        |j        ||
|||	||||j                  S )zCreate and fill a TestReport with standard item and call info.

        :param item: The item.
        :param call: The call info.
        collectc                     i | ]}|d S )   rQ   )rn   xs     r6   
<dictcomp>z1TestReport.from_item_and_call.<locals>.<dictcomp>L  s    000QAq000rN   rB   NrC   rD   z=There should always be a traceback entry for skipping a test.   r   r   tbstyleauto)stylez	Captured r   )r   )r<   r   r   r   r   excinfo
isinstancer   valuer&   	Exception_getreprcrash_use_item_location
reportinfoosr   messagerX   pathr   repr_failure_repr_failure_pyr   	getoption_report_sectionsappendr@   r=   r   )r   r   r   r<   r   r   r   r   r   r?   rE   r>   rr   rW   rwhenrO   r`   s                     r6   from_item_and_callzTestReport.from_item_and_call?  s    yy    =
y00$-000,|  	>FG  H g}55 ""GM4>:: #))++MMR "MM=3 B!%!2!22A2!6JD$+++!yq!)CHH #AFQXqyAHH"9&&#0099HH#44t{'<'<Y'O'O  5    H $(#8 	B 	BE3OO666u66@AAAAsKM 0
 
 
 	
rN   )rQ   r   r   r   N)r   r   r   __doc____test__rX   r   r   r   r   r   r   r   r   r   r   r!   r	   floatr   rM   r   r   r%   r   rQ   rN   r6   r   r      s          H MMM /1BF:$ :$:$ Xc]C/0:$ #s(#	:$
 67:$ -.c3m0Dc<W
:$ 12:$ 5c?+:$ :$ :$ :$ "(5f+=">?:$  
!:$ :$ :$ :$xj# j j j j >
d >
2B >
| >
 >
 >
 [>
 >
 >
rN   r   c                      e Zd ZdZdZ	 ddedddedee         e	ee
ef         eef         d	eeeeef                           d
ee	eef                  ddfdZedee	eee
         ef                  fd            ZdefdZdS )CollectReportzSCollection report object.

    Reports can contain arbitrary extra attributes.
    r   rQ   r@   rE   z&Literal['passed', 'failed', 'skipped']r>   Nresultr?   rG   c                     || _         || _        || _        |pg | _        t	          |          | _        | j                            |           d S rI   )r@   rE   r>   r   r   r?   rJ   rK   )rL   r@   rE   r>   r   r?   r   s          r6   rM   zCollectReport.__init__  sU       ! l XU#####rN   c                      | j         d | j         fS rI   )r   rr   s    r6   r=   zCollectReport.location  s     T4;//rN   c                 R    d| j         dt          | j                   d| j        dS )Nz<CollectReport z lenresult=r   r   )r@   lenr   rE   rr   s    r6   r   zCollectReport.__repr__  s3    ggg3t{;K;KggVZVbggggrN   )rQ   )r   r   r   r   r<   rX   r   r   r   r   r   r!   r   r   r%   r$   r	   rM   r   r=   r   rQ   rN   r6   r   r     s        
 D /1$ $$ :$ -.c3m0Dc<W
	$ eD)O456$ 5c?+$ 
$ $ $ $> 0	%Xc]C/0	10 0 0 X0
h# h h h h h hrN   r   c                   .    e Zd ZdeddfdZdeddfdZdS )CollectErrorReprmsgrG   Nc                     || _         d S rI   )r>   )rL   r   s     r6   rM   zCollectErrorRepr.__init__  s    rN   rS   c                 >    |                     | j        d           d S )NT)red)rW   r>   )rL   rS   s     r6   rU   zCollectErrorRepr.toterminal  s     D)))))rN   )r   r   r   rX   rM   r"   rU   rQ   rN   r6   r   r     sX        C D    *n * * * * * * *rN   r   r   c                     t          | t          t          f          r%|                                 }| j        j        |d<   |S d S )N$report_type)r   r   r   r   r   r   )r   datas     r6   pytest_report_to_serializabler     sD     &:}566   %/8^4rN   r   c                     d| v ro| d         dk    rt                               |           S | d         dk    rt                              |           S J d                    | d                               d S )Nr   r   r   Fz(Unknown report_type unserialize data: {})r   r   r   r1   )r   s    r6   pytest_report_from_serializabler     s     <//((....!_44 ++D111	
@GG 
 
 	
 	
 	
 4rN   c                 4   dt           t          t          f         dt          t          t
          f         fddt          dt          t          t
          f         ffddt          t                   dt          t          t          t
          f                  fddt          dt          t          t
          f         ffd	}| j
                                        }t          | j        d
          rQt          | j        d          r$t          | j        d          r ||           |d<   n"t	          | j                  |d<   n
| j        |d<   |D ]K}t          ||         t          j                  rt          j        ||                   ||<   @|dk    rd||<   L|S )zReturn the contents of this report as a dict of builtin entries,
    suitable for serialization.

    This was originally the serialize_report() function from xdist (ca03269).
    entryrG   c                     t          j        |           }|                                D ],\  }}t          |d          rt          j        |          ||<   -t	          |           j        |d}|S )NrJ   )typer   )dataclassesasdictitemsrV   r   r   )r   r   rO   r   
entry_datas        r6   serialize_repr_entryz-_report_to_json.<locals>.serialize_repr_entry  sr     !%((**,, 	6 	6JCuj)) 6'.u55S	"5kk2DAA
rN   reprtracebackc                 \    t          j        |           }fd| j        D             |d<   |S )Nc                 &    g | ]} |          S rQ   rQ   )rn   r   r   s     r6   
<listcomp>zE_report_to_json.<locals>.serialize_repr_traceback.<locals>.<listcomp>  s2     !
 !
 !
()  ##!
 !
 !
rN   reprentries)r   r   r  )r   r   r   s     r6   serialize_repr_tracebackz1_report_to_json.<locals>.serialize_repr_traceback  sJ    #M22!
 !
 !
 !
-:-F!
 !
 !
} rN   	reprcrashc                 2    | t          j        |           S d S rI   )r   r   )r  s    r6   serialize_repr_crashz-_report_to_json.<locals>.serialize_repr_crash  s       %i0004rN   repc                 X   | j         J t          t          | j                   } |j                   |j                  |j        d}t          |t                    rDg |d<   |j        D ]6\  }}}|d         	                     |           |          |f           7nd |d<   |S )N)r  r   r?   chain)
r>   r   r   r  r   r?   r   r   r
  r   )r  r>   r   repr_traceback
repr_crashdescriptionr  r  s         r6   serialize_exception_longreprz5_report_to_json.<locals>.serialize_exception_longrepr  s    |'''s|44--h.@AA55h6LMM )"
 "

 h 233 	# F7O;C>  7
Kw&&00@@,,Z88#    #F7OrN   rU   r>   r   N)r   r   r   r   rX   r   r    r   r   r9   rJ   copyrV   r>   r   r   PathLiker   )r   r  r3   r_   r  r   r  s       @@@r6   r   r     s   Y/0	c3h    $sCx.      ,-	$sCx.	!   * c3h       . 	Av-- (6?O44 	1O[:
 :
 	1 98@@AjMM00AjMM*  agr{++ 	i$((AdGGXAdGHrN   r   c                 "     fdfd}dt           t          t          t          f                  fd} d         rd d         v rd d         v r | d         d                   } | d         d                   } d         d         rQg } d         d         D ]0\  }}}|                     ||           ||          |f           1t          |          }	nt          ||	          }	 d         d
         D ]}
 |	j        |
  |	 d<    S )zReturn **kwargs that can be used to construct a TestReport or
    CollectReport instance.

    This was originally the serialize_report() function from xdist (ca03269).
    c                    | d         }| d         }|dk    r~d }d }d }|d         rt          di |d         }|d         rt          di |d         }|d         rt          |d         d                   }t          |d         ||||d         	          }n2|d
k    rt	          |d                   }nt          |t                     |S )Nr   r   r   reprfuncargsreprfileloc
reprlocalslinesr   )r  r  r  r  r   r   rQ   )r   r   r   r   r   r   r   )r   r   
entry_typer  r  r  	reprentryr   s          r6   deserialize_repr_entryz8_report_kwargs_from_json.<locals>.deserialize_repr_entry$  s   &!'
$$LKJN# D+CCd>.BCCM" F.EEm1DEEL! E'\(:7(CDD
;D7m)%'7m< < <II ,,,'W66II+J
JOOOrN   c                 J    fd| d         D             | d<   t          di | S )Nc                 &    g | ]} |          S rQ   rQ   )rn   r   r  s     r6   r  zP_report_kwargs_from_json.<locals>.deserialize_repr_traceback.<locals>.<listcomp>@  s2     .
 .
 .
*+""1%%.
 .
 .
rN   r  rQ   r   )repr_traceback_dictr  s    r6   deserialize_repr_tracebackz<_report_kwargs_from_json.<locals>.deserialize_repr_traceback?  sM    .
 .
 .
 .
/B=/Q.
 .
 .
M* 332333rN   repr_crash_dictc                 "    | t          di | S d S )NrQ   r   )r  s    r6   deserialize_repr_crashz8_report_kwargs_from_json.<locals>.deserialize_repr_crashE  s!    &#66o6664rN   r>   r  r   r
  )r   r  r?   )r   r   rX   r   r   r   r   
addsection)r   r  r   r   r  r
  repr_traceback_datarepr_crash_datar  exception_infosectionr  s   `          @r6   r   r     s       64 4 4 4 4c3h0H     	: 0:j111z*55522z"?3
 
 +*:j+A++NOO	j!'* 	EEOFF 	 	A#_k 223FGG..??#    #5)) N /+#  N
 "*-j9 	0 	0G%N%w///!/
:rN   )9r   ior   r   r   typingr   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   _pytest._code.coder   r   r   r   r   r   r   r   r   r    r!   _pytest._ior"   _pytest.configr#   _pytest.nodesr$   r%   _pytest.outcomesr&   _pytest.runnerr'   r7   r8   r9   rX   r   r   r   r   r   r   r   r   rQ   rN   r6   <module>r.     s             				                                                                                                             1 1 1 1 1 1 , , , , , , , , , , , , ( ( ( ( ( ( . . . . . . 0 0 0 0 0 0 / / / / / / + + + + + + ) ) ) ) ) ) , , , , , , + + + + + + & & & & & & ! ! ! ! ! ! # # # # # #       ! ! ! ! ! !  (''''''	 	 	 WT&&&f f f f f f f fR**"&z"2** * * * J
 J
 J
 J
 J
 J
 J
 J
Z .h .h .h .h .hJ .h .h .hb* * * * *| * * *-+,d38n   
sCx.eM:-./   FJ F4S> F F F FRPc3h PDcN P P P P P PrN   