
    iWL                       S r SSKJr  SSKrSSKJr  SSKrSSKrSSKrSSK	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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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SK%J&r&  SSK%J'r'  SSK%J(r(  SSK%J)r)  \RT                  S:  a  SSK+J,r,  \(       a  SS K-J.r.  SS!K/J0r0  S:S" jr1S;S# jr2S<S$ jr3S<S% jr4S=S& jr5 S>       S?S( jjr6S@S) jr7S@S* jr8S@S+ jr9SAS, jr:      SBS- jr;SCS. jr< SD       SES/ jjr=SFS0 jr>\" S1S'S29r?\\R                   " S3 S4\\?   5      5       5       rASGS5 jrBSHS6 jrC " S7 S85      rDSHS9 jrEg)Iz3Basic collect and runtest protocol implementations.    )annotationsN)Callable)cast)final)Generic)Literal)TYPE_CHECKING)TypeVar   )
BaseReport)CollectErrorRepr)CollectReport)
TestReport)timing)ExceptionChainRepr)ExceptionInfo)TerminalRepr)Parser)check_ispytest)	Collector)	Directory)Item)Node)Exit)OutcomeException)Skipped)TEST_OUTCOME)      )BaseExceptionGroup)Session)TerminalReporterc           	         U R                  SSSS9nUR                  SS[        S SSS	9  UR                  S
S[        S SSS	9  g )Nzterminal reporting	Reportinggeneral)afterz--durationsstoreNz1Show N slowest setup/test durations (N=0 for all))actiontypedefaultmetavarhelpz--durations-minzcMinimal duration in seconds for inclusion in slowest list. Default: 0.005 (or 0.0 if -vv is given).)getgroup	addoptionintfloat)parsergroups     M/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/_pytest/runner.pypytest_addoptionr5   2   sa    OO0+YOOE	OO@   
OO3      c                   U R                   R                  R                  nU R                   R                  R                  nU R                   R	                  5       nUc  g Uc
  US:  a  SOSnU n/ nUR
                  R                  5        H0  nU H'  n[        US5      (       d  M  UR                  U5        M)     M2     U(       d  g UR                  S SS9  U(       d  UR                  SS	5        OUR                  SS
U S35        US U n[        U5       H  u  pUR                  U:  ae  UR                  S5        S[        U5      U-
   SUS S3n	U R                   R                  R                  c  U	S-  n	U	S-  n	UR                  U	5          g UR                  UR                  S SUR                  S SUR                    35        M     g )N   g{Gzt?g        durationc                    U R                   $ N)r9   )xs    r4   <lambda>)pytest_terminal_summary.<locals>.<lambda>W   s    QZZr6   T)keyreverse=zslowest durationszslowest z
 durations (z durations < gz	s hidden.z"  Use -vv to show these durations.)z02.2fzs z<8 )configoption	durationsdurations_minget_verbositystatsvalueshasattrappendsort	write_sep	enumerater9   
write_linelenwhennodeid)
terminalreporterrI   rJ   verbosetrdlistreplistrepimessages
             r4   pytest_terminal_summaryr_   G   s    ''..88I$++22@@M%%335G!(1#	BE88??$CsJ''S!  % 	JJ'J6
S-.
SHYKz:;jy!E"<<-'MM"#e*q.)}Q6GyQG&&--;;C??sNGMM'"
e,Bsxxm1SZZLIJ #r6   c                "    [        5       U l        g r;   )
SetupState_setupstatesessions    r4   pytest_sessionstartre   j   s    $,Gr6   c                :    U R                   R                  S 5        g r;   )rb   teardown_exactrc   s    r4   pytest_sessionfinishrh   n   s    &&t,r6   c                    U R                   nUR                  U R                  U R                  S9  [	        XS9  UR                  U R                  U R                  S9  g)N)rV   locationnextitemT)ihookpytest_runtest_logstartrV   rj   runtestprotocolpytest_runtest_logfinish)itemrl   rm   s      r4   pytest_runtest_protocolrr   r   sL    JJE	!!t}}!MD,	""$++"Nr6   Tc           	     P   [        U S5      nU(       a!  U R                  (       d  U R                  5         [        U SU5      nU/nUR                  (       ai  U R
                  R                  SS5      (       a  [        U 5        U R
                  R                  SS5      (       d  UR                  [        U SU5      5        U R                  R                  (       d  U R                  R                  (       a  S nUR                  [        U SXS95        U(       a  SU l        S U l        U$ )	N_requestsetup	setupshowF	setuponlycallteardownrk   )rN   rt   _initrequestcall_and_reportpassedrG   	getoptionshow_test_itemrO   rd   
shouldfail
shouldstopfuncargs)rq   logrl   
hasrequestr\   reportss         r4   ro   ro   z   s     z*J$-- 	
$
-CeG
zz;;  e444 {{$$[%88NN?4=> ||$,,"9"9NN?4SLM Nr6   c                h   U R                   R                  5       nUR                  5         UR                  S5        UR                  U R                  5        [        [        U S/ 5      5      nU(       a/  UR                  SR                  SR                  U5      5      5        UR                  5         g)zAShow test function, parameters and the fixtures of the test item.z        fixturenamesz (fixtures used: {})z, N)
rG   get_terminal_writerlinewriterV   sortedgetattrformatjoinflush)rq   twused_fixturess      r4   r~   r~      sy    		(	(	*BGGIHHWHHT[[74<=M
'..tyy/GHIHHJr6   c                f    [        U S5        U R                  R                  R                  U 5        g )Nru   )_update_current_test_varrd   rb   ru   )rq   s    r4   pytest_runtest_setupr      s$    T7+LL""4(r6   c                   [        U S5         [        ?[        ?[        ?[        R
                  S:  a  [        ? U R                  5         g ! [         a     Nf = f! [         ar  n[        U5      [        l        U[        l        [        R
                  S:  a  U[        l        UR                  c   eUR                  R                  [        l        e S nAff = f)Nrx   )r      r   )r   sys	last_type
last_valuelast_tracebackversion_infolast_excAttributeErrorruntest	Exceptionr*   __traceback__tb_next)rq   es     r4   pytest_runtest_callr      s    T6*MNz)    	Qz)CL***__44	s)   ,A A 
AA
C&A-CCc                ~    [        U S5        U R                  R                  R                  U5        [        U S 5        g )Nry   )r   rd   rb   rg   )rq   rl   s     r4   pytest_runtest_teardownr      s.    T:.LL++H5T4(r6   c                    SnU(       a8  U R                    SU S3nUR                  SS5      nU[        R                  U'   g[        R                  R	                  U5        g)zUpdate :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 (rE    z(null)N)rV   replaceosenvironpop)rq   rU   var_namevalues       r4   r   r      sP     %H;;-r$q)fh/$

8


x r6   c                n    U R                   S;   a%  U R                  (       a  gU R                  (       a  ggg )N)ru   ry   )errorEERROR)skippedsSKIPPED)rB   rB   rB   )rU   failedr   reports    r4   pytest_report_teststatusr      s)    {{++==(^^,r6   c                  ^ ^^ T R                   nUS:X  a  UR                  mO0US:X  a  UR                  mOUS:X  a  UR                  mO
 SU 35       e[        4nT R
                  R                  SS5      (       d
  U[        4-  n[        R                  U UU4S jXS9nUR                  T US	9nU(       a  UR                  US
9  [        Xg5      (       a  UR                  T XgS9  U$ )Nru   rx   ry   FzUnhandled runtest hook case: usepdbc                    > T" SST 0TD6$ )Nrq    r   )rq   kwdsruntest_hooks   r4   r=   !call_and_report.<locals>.<lambda>   s    /$/$/r6   )rU   reraiserq   rx   r   noderx   r   )rm   r   r   r   r   rG   r}   KeyboardInterruptCallInfo	from_callpytest_runtest_makereportpytest_runtest_logreportcheck_interactive_exceptionpytest_exception_interact)	rq   rU   r   r   rm   r   rx   r   r   s	   `  `    @r4   r{   r{      s     JJEw,1,F,F	00		44<5dV<<u04wG;;  511%''/d  D 88d8NF
&&f&5"400''T'LMr6   c                    U R                   c  g[        US5      (       a  g[        U R                   R                  [        [
        R                  45      (       a  gg)zRCheck whether the call raised an exception that should be reported as
interactive.FwasxfailT)excinforN   
isinstancer   r   bdbBdbQuit)rx   r   s     r4   r   r      sG     ||vz""$,,$$w&<==r6   TResult)	covariantc                      \ rS rSr% SrS\S'   S\S'   S\S'   S\S	'   S\S
'   S\S'   SS.               SS jjr\SS j5       r\	 S       SS jj5       r
SS jrSrg)r   i  z/Result/Exception info of a function invocation.TResult | None_result#ExceptionInfo[BaseException] | Noner   r1   startstopr9   /Literal['collect', 'setup', 'call', 'teardown']rU   F)	_ispytestc               b    [        U5        Xl        X l        X0l        X@l        XPl        X`l        g r;   )r   r   r   r   r   r9   rU   )selfresultr   r   r   r9   rU   r   s           r4   __init__CallInfo.__init__#  s*     	y!
	 	r6   c                n    U R                   b  [        U < S35      e[        [        U R                  5      $ )z\The return value of the call, if it didn't raise.

Can only be accessed if excinfo is None.
z has no valid result)r   r   r   r   r   r   s    r4   r   CallInfo.result6  s4     <<# D8+?!@AA GT\\**r6   Nc           
     h   Sn[         R                  " 5       n U" 5       nUR                  5       nU " UR                  R                  UR                  R                  UR                  UUUSS9$ ! [         a9    [        R                  " 5       nUb  [        UR                  U5      (       a  e Sn Nf = f)ag  Call func, wrapping the result in a CallInfo.

:param func:
    The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
: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   r9   rU   r   r   r   )r   InstantBaseExceptionr   from_currentr   r   elapsedr   timer   seconds)clsfuncrU   r   r   instantr   r9   s           r4   r   CallInfo.from_callC  s    $ .."	%)VF ??$..%%##%%
 	
  	#002G"z'--'I'IF		s   A. .A B10B1c                    U R                   c  SU R                  < SU R                  < S3$ SU R                  < SU R                   < S3$ )Nz<CallInfo when=z	 result: >z	 excinfo=)r   rU   r   r   s    r4   __repr__CallInfo.__repr__i  sH    <<$TYYM4<<:J!LL Yt||6FaHHr6   )r   r9   r   r   r   rU   )r   r   r   r   r   r1   r   r1   r9   r1   rU   r   r   boolreturnNone)r   r   r;   )r   zCallable[[], TResult]rU   r   r   z<type[BaseException] | tuple[type[BaseException], ...] | Noner   zCallInfo[TResult])r   str)__name__
__module____qualname____firstlineno____doc____annotations__r   propertyr   classmethodr   r   __static_attributes__r   r6   r4   r   r     s     :00L
KO
99   5 	
   >  
& 
+ 
+ 
 QU	#
##
 >#
 N	#

 
#
 #
JIr6   r   c                .    [         R                  " X5      $ r;   )r   from_item_and_callr   s     r4   r   r   o  s    ((44r6   c                  ^  S
U 4S jjn[         R                  US[        [        4S9nS nUR                  (       d  SnGOI[
        /n[        R                  R                  S5      nUb  UR                  UR                  5        [        UR                  R                  [        U5      5      (       a  SnT R                  UR                  S5      n[        U[        5      (       d   [!        U5      5       eUR"                  nU(       d   e[%        UR&                  5      UR(                  UR*                  4nORSnT R-                  UR                  5      n	[/        U	S	5      (       d"  [        U	[$        5      (       d   e[1        U	5      n	U	nUR                  (       d  UR2                  OS n
[5        T R6                  XCU
5      nX+l        U$ )Nc                 L  > [        T [        5      (       av  T R                  R                  R	                  T R
                  T R                  R                  S5      T R                  R                  T R                  R                  S5      S9  [        T R                  5       5      $ )N
importmodeconsider_namespace_packages)rootpathr  )r   r   rG   pluginmanager_loadconftestmodulespathr}   r  getinilistcollect	collectors   r4   r  +pytest_make_collect_report.<locals>.collectt  s     i++**??  **<8"))22,5,<,<,C,C1-	 @  I%%'((r6   r  )r   r|   unittestr   r   r   
toterminal)r   zlist[Item | Collector])r   r   r   
SystemExitr   r   r   modulesgetrO   SkipTestr   r   tuple_repr_failure_pyr   repr	reprcrashr   r  linenor^   repr_failurerN   r   r   r   rV   rx   )r  r  rx   longreproutcomeskip_exceptionsr  r_r	errorinfor   r\   s   `           r4   pytest_make_collect_reportr!  s  sk   )& %6
$C  D BFH<<:B");;??:.""8#4#45dll((%*@AAG++DLL&ABb"455?tBx?5AH1AFFQXXqyy9HG!..t||<I9l33!)S1111,Y7	 H $T[[$F
	(('V
DCHJr6   c                  @    \ rS rSrSrS	S jrS
S jrSS jrSS jrSr	g)ra   i  a  Shared 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!
c                    0 U l         g r;   stackr   s    r4   r   SetupState.__init__  s      	
r6   c                   UR                  5       nU R                  R                  5        H2  u  nu  pEX2;   d   S5       eU(       d  M  US   R                  US   5      e   U[	        U R                  5      S  HA  nX0R                  ;  d   eUR
                  /S4U R                  U'    UR                  5         MC     g! [         a2  nU R                  U   S   XUR                  44U R                  U'   e SnAff = f)z4Setup objects along the collector chain to the item.z(previous item was not torn down properlyr   r   N)		listchainr%  itemswith_tracebackrT   ry   ru   r   r   )r   rq   needed_collectorscol
finalizersexcs         r4   ru   SetupState.setup  s     NN, '+jj&6&6&8"C"*+W-WW+s!f++CF33 '9
 %S_%67Cjj((( #~t4DJJsO		 8   #'::c?1#5=N=N7O"P

3s   *B??
C;	-C66C;c                    U(       a  [        U[        5      (       a   e[        U5      (       d   eX R                  ;   d   X R                  45       eU R                  U   S   R	                  U5        g)zWAttach a finalizer to the given node.

The node must be currently active in the stack.
r   N)r   r  callabler%  rO   )r   	finalizerr   s      r4   addfinalizerSetupState.addfinalizer  sb    
 JtU3333	""""zz!5D**#55!

4""9-r6   c           	        U=(       a    UR                  5       =(       d    / n/ nU R                  (       a  [        U R                  R                  5       5      US[	        U R                  5       :X  a  OU R                  R                  5       u  nu  pV/ nU(       a!  UR                  5       n U" 5         U(       a  M!  [	        U5      S:X  a  UR                  U5        O-U(       a&  SU< 3n
UR                  [        XSSS2   5      5        U R                  (       a  M  [	        U5      S:X  a  US   eU(       a  [        SUSSS2   5      eUc  U R                  (       a   egg! [         a  n	UR                  U	5         Sn	A	NSn	A	ff = f)zTeardown 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   zerrors while tearing down r   zerrors during test teardown)r(  r%  r
  keysrT   popitemr   r   rO   extendr    )r   rl   r+  
exceptionsr   r-  _these_exceptionsfinr   msgs              r4   rg   SetupState.teardown_exact  sY    &>(*<*<*>E2*,
jjDJJOO%&*;<Mc$**o*NN$(JJ$6$6$8!D/:! nn&/E * #$)!!"23!24(;!!"4S4R4:P"QR! jjj$ z?aQ-$%BJtQStDTUUzz!>z  $ /$++A../s   -E# #
F-FFr$  N)r   r   rq   r   r   r   )r2  zCallable[[], object]r   r   r   r   )rl   Item | Noner   r   )
r   r   r   r   r   r   ru   r3  rg   r   r   r6   r4   ra   ra     s    =~
*. "r6   ra   c                    U R                   nUR                  U S9  UR                  U S9nUR                  R	                  SS 5      nU(       a   [        X25      (       a  UR                  XUS9  U$ )Nr  rx   r   )rm   pytest_collectstartr!  __dict__r   r   r   )r  rm   r\   rx   s       r4   collect_one_noderE  4  sk    OOE		299I9NC<<FD)D+D66''Y#'NJr6   )r2   r   r   r   )rW   r"   r   r   )rd   r!   r   r   )rq   r   rl   rA  r   r   )TN)rq   r   r   r   rl   rA  r   zlist[TestReport]r@  )rq   r   rl   rA  r   r   )rq   r   rU   z+Literal['setup', 'call', 'teardown'] | Noner   r   )r   r   r   ztuple[str, str, str] | None)T)rq   r   rU   z$Literal['setup', 'call', 'teardown']r   r   r   r   )rx   zCallInfo[object]r   r   r   r   )rq   r   rx   zCallInfo[None]r   r   )r  r   r   r   )Fr   
__future__r   r   collections.abcr   dataclassesr   r   typestypingr   r   r   r   r	   r
   r   r   r   r   r   _pytestr   _pytest._code.coder   r   r   _pytest.config.argparsingr   _pytest.deprecatedr   _pytest.nodesr   r   r   r   _pytest.outcomesr   r   r   r   r   exceptiongroupr    _pytest.mainr!   _pytest.terminalr"   r5   r_   re   rh   rr   ro   r~   r   r   r   r   r   r{   r   r   	dataclassr   r   r!  ra   rE  r   r6   r4   <module>rU     s   9 " 
 $  	 
          % "   1 , + , - # #   ! - $ ) g1$1* KF'- ;?
,78	)
0)!
!A!	!"	" IM
:AE4 )t
, XIww XI  XIv50fK" K"\r6   