
    9[g'                    &   d Z ddlmZ ddlmZ ddlZddlZddlZddl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Z!d%dZ"d&dZ# ejH                  d       G d d             Z%d'dZ& ejH                  d       G d d             Z'd(dZ( e ee'             Z) ed      d)d       Z* ed       d*d!       Z+ ed       	 	 	 	 	 	 d+d"       Z,d,d#Z-y)-z-Support for skip/xfail functions and markers.    )annotations)MappingN)	Generator)Optional)Config)hookimpl)Parser)Mark)Item)fail)skip)xfail)
BaseReport)
TestReport)CallInfo)StashKeyc                |    | j                  d      }|j                  ddddd       | j                  dd	dd
       y )Ngeneralz
--runxfail
store_truerunxfailFz<Report the results of xfail tests as if they were not marked)actiondestdefaulthelpxfail_strictz\Default for the strict parameter of xfail markers when not given explicitly (default: False)bool)r   type)getgroup	addoptionaddini)parsergroups     K/var/www/html/bid-api/venv/lib/python3.12/site-packages/_pytest/skipping.pypytest_addoptionr$      sQ    OOI&E	OOK   MM	=      c                4   | j                   j                  rJdd lj                  | j	                  fd       d }t        j
                  |_        t        d|       | j                  dd       | j                  dd       | j                  dd       y )	Nr   c                     t        d       S )Nr   )setattr)oldpytests   r#   <lambda>z"pytest_configure.<locals>.<lambda>6   s    767C#@r%   c                      y )N )argskwargss     r#   nopzpytest_configure.<locals>.nop8   s    r%   r   markerszskip(reason=None): skip the given test function with an optional reason. Example: skip(reason="no way of currently testing this") skips the test.a  skipif(condition, ..., *, reason=...): skip the given test function if any of the conditions evaluate to True. Example: skipif(sys.platform == 'win32') skips the test if we are on the win32 platform. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-skipifa  xfail(condition, ..., *, reason=..., run=True, raises=None, strict=xfail_strict): mark the test function as an expected failure if any of the conditions evaluate to True. Optionally specify a reason for better reporting and run=False if you don't even want to execute the test function. If only specific exception(s) are expected, you can list them in raises, and if the test fails in other ways, it will be reported as a true failure. See https://docs.pytest.org/en/stable/reference/reference.html#pytest-mark-xfail)optionr   r*   r   add_cleanup	Exceptionr(   addinivalue_line)configr0   r)   r*   s     @@r#   pytest_configurer7   0   s    }}ll@A	 %
	 	\ 	k	r%   c                   t        |t              rt        t        t        | j
                  d}t        | j                  j                  | j
                              D ]1  }t        |t              st        d|      |j                  |       3 t        | d      r%|j                  | j                  j                         	 d|j                   d}t!        ||d      }t#        ||      }n	 t5        |      }|j6                  j9                  dd      }
|
9t        |t              r	d|z   }
|
fS d|j                  ddz   }t)        |d       |
fS # t$        $ rT}d|j                  d	d
|z   d
d|j&                  xs dz  z   dz   dg}	t)        dj+                  |	      d       Y d}~d}~wt,        $ r[}d|j                  d	d
|z   gt/        j0                  t3        |      |      }	t)        dj+                  |	      d       Y d}~d}~ww xY w# t,        $ rW}d|j                  dgt/        j0                  t3        |      |      }	t)        dj+                  |	      d       Y d}~xd}~ww xY w)a.  Evaluate a single skipif/xfail condition.

    If an old-style string condition is given, it is eval()'d, otherwise the
    condition is bool()'d. If this fails, an appropriately formatted pytest.fail
    is raised.

    Returns (result, reason). The reason is only relevant if the result is True.
    )ossysplatformr6   )r6   z8pytest_markeval_namespace() needs to return a dict, got obj<z condition>evalzError evaluating z
 conditionz     r   ^zSyntaxError: invalid syntax
F)pytraceNz condition as a booleanreasonzcondition: z: zDyou need to specify reason=STRING when using booleans as conditions.)
isinstancestrr9   r:   r;   r6   reversedihookpytest_markeval_namespacer   
ValueErrorupdatehasattrr<   __globals__namecompiler>   SyntaxErroroffsetr   joinr4   	tracebackformat_exception_onlyr   r   r/   get)itemmark	conditionglobals_
dictionaryfilenamecondition_coderesultexcmsglinesrC   msgs               r#   evaluate_conditionr`   W   sn    )S! kk	
 #JJ000D
J j'2 Nzn]  OOJ'
 4OODHH001	5499+[1H$Y&AN.(3F&	5)_F [[__Xt,F~i%"Y.F 6> $DII=3XY  e$6>O  	5#DII=
;"

a0036-	H 8$e44 	5#DII=
;" 00cC@H
 8$e44	5  	5#DII=0GH00cC@H 8$e44	5s?   )E .H 	HA
F,,H8AHH	I6AI11I6T)frozenc                       e Zd ZU dZdZded<   y)Skipz$The result of evaluate_skip_marks().zunconditional skiprE   rC   N)__name__
__module____qualname____doc__rC   __annotations__r-   r%   r#   rc   rc      s    .&FC&r%   rc   c                   | j                  d      D ]  }d|j                  vr|j                  }n|j                  d   f}|s)|j                  j                  dd      }t	        |      c S |D ]#  }t        | ||      \  }}|st	        |      c c S   | j                  d      D ]#  }	 t	        |j                  i |j                  c S  y# t        $ r}t        t        |      dz         dd}~ww xY w)	zDEvaluate skip and skipif marks on item, returning Skip if triggered.skipifrM   rW   rC    r   z& - maybe you meant pytest.mark.skipif?N)iter_markersr/   r.   rT   rc   r`   	TypeErrorrE   )rU   rV   
conditionsrC   rW   r\   es          r#   evaluate_skip_marksrq      s    !!x!0dkk)J++k24J [[__Xr2F< $I/dIFNFFF|# $ 1" !!v!.	Y2dkk22 /   	YCF%MMNTXX	Ys   ,C	C5C00C5c                  >    e Zd ZU dZdZded<   ded<   ded<   ded	<   y
)Xfailz%The result of evaluate_xfail_marks().)rC   runstrictraisesrE   rC   r   rt   ru   z&tuple[type[BaseException], ...] | Nonerv   N)rd   re   rf   rg   	__slots__rh   r-   r%   r#   rs   rs      s    /5IK	IL22r%   rs   c                   | j                  d      D ]  }|j                  j                  dd      }|j                  j                  d| j                  j	                  d            }|j                  j                  dd      }d	|j                  vr|j
                  }n|j                  d	   f}|s,|j                  j                  d
d      }t        ||||      c S |D ]&  }t        | ||      \  }}|st        ||||      c c S   y)z;Evaluate xfail marks on item, returning Xfail if triggered.r   rk   rt   Tru   r   rv   NrW   rC   rl   )rm   r/   rT   r6   getinir.   rs   r`   )	rU   rV   rt   ru   rv   ro   rC   rW   r\   s	            r#   evaluate_xfail_marksrz      s    !!w!/kkooeT*4;;+=+=n+MN40dkk)J++k24J [[__Xr2Fff55 $I/dIFNFFVS&&99 $ 0( r%   )tryfirstc                .   t        |       }|r!t        j                  |j                  d      t	        |       x| j
                  t        <   }|rG| j                  j                  j                  s&|j                  st        d|j                  z          y y y y )NT)_use_item_location	[NOTRUN] )rq   r   r4   rC   rz   stashxfailed_keyr6   r2   r   rt   r   )rU   skippedxfaileds      r#   pytest_runtest_setupr      ss    !$'GnnW^^EE(<T(BBDJJ{gt{{))227;;kGNN*+ <G2wr%   )wrapperc              #  .  K   | j                   j                  t        d       }|t        |       x| j                   t        <   }|rD| j                  j
                  j                  s$|j                  st        d|j                  z          	 d | j                   j                  t        d       }|t        |       x| j                   t        <   }S S # | j                   j                  t        d       }|t        |       x| j                   t        <   }w w xY ww)Nr~   )
r   rT   r   rz   r6   r2   r   rt   r   rC   )rU   r   s     r#   pytest_runtest_callr      s     jjnn[$/G,@,FF

;'t{{))227;;kGNN*+K **..d3?0DT0JJDJJ{#g  **..d3?0DT0JJDJJ{#g s    BD
C ADADDc              #  ,  K   d }| j                   j                  t        d       }| j                  j                  j
                  r	 |S |j                  rt        |j                  j                  t        j                        rS|j                  j                  j                  J d|j                  j                  j                  z   |_        d|_        |S |j                  s|r|j                  rQ|j                  }|)t        |j                  j                  |      s	d|_        |S d|_        |j                   |_        |S |j"                  dk(  rA|j$                  rd|_        d|j                   z   |_        |S d|_        |j                   |_        |S w)Nzreason: r   failedcallz[XPASS(strict)] passed)r   rT   r   r6   r2   r   excinforD   valuer   r4   r_   wasxfailoutcomer   rv   rC   whenru   longrepr)rU   r   repr   rv   s        r#   pytest_runtest_makereportr   	  sM     Cjjnn[$/G{{""( J' 
*T\\%7%7I||!!%%111!DLL$6$6$:$::  J [[W<<^^F!*T\\5G5G*P& J (&~~ J YY& ~~&1GNNB J '&~~Js   FFc                P    t        | d      r| j                  ry| j                  ryy )Nr   )r   xXFAIL)xpassedXXPASS)rK   r   r   )reports    r#   pytest_report_teststatusr   '  s#    vz">>*]]*r%   )r!   r	   returnNone)r6   r   r   r   )rU   r   rV   r
   rW   objectr   ztuple[bool, str])rU   r   r   zSkip | None)rU   r   r   zXfail | None)rU   r   r   r   )rU   r   r   zGenerator[None])rU   r   r   zCallInfo[None]r   z'Generator[None, TestReport, TestReport])r   r   r   ztuple[str, str, str] | None).rg   
__future__r   collections.abcr   dataclassesr9   r;   r:   rR   typingr   r   _pytest.configr   r   _pytest.config.argparsingr	   _pytest.mark.structuresr
   _pytest.nodesr   _pytest.outcomesr   r   r   _pytest.reportsr   r   _pytest.runnerr   _pytest.stashr   r$   r7   r`   	dataclassrc   rq   rs   rz   r   r   r   r   r   r-   r%   r#   <module>r      s.   3 " #  	  
    ! # , (  ! ! " & & # "&$NFR d#' ' $'8 d#3 3 $34 (hx') 
4, , 
$K K" 
$
$, :r%   