bgR@ddlZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z ddlm Z dd lm Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddl!m"Z"ddl#m$Z$ddl%m&Z&erddl'm(Z(dZ)d e*fd!Z+d"e d#ee,d d$fd%Z-Gd&d'eZ.eej/d()Gd*d+Z0ed,eed-e1fe2f.Z3ej/Gd/d$Z4d(d0d1ee1e2fd2e*d e e0fd3Z5d4e ee0e4fd e e0fd5Z6d6e0d dfd7Z7erZdd8l8m9Z9Gd9d:e4Z:Gd;de4Z<Gd?d@e4Z=GdAdBe4Z>GdCdDe4Z?eGdEdFZ@e@d(GZAeGdHdIe e,efZBdS)JN)Any)Callable) Collection)Iterable)Iterator)List)Mapping)MutableMapping) NamedTuple)Optional)overload)Sequence)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union) getfslineno) ascii_escaped)final)NOTSET) NotSetType)Config)check_ispytest)fail)PytestUnknownMarkWarning)Nodeempty_parameter_set_markreturncJt|ot|dddkS)N__name__z)callablegetattr)funcs h/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/mark/structures.py istestfuncr()s$ D>> QgdJ CCzQQconfigargnames MarkDecoratorcddlm}t|\}}d||j||fz}|t }|dvrt |}nn|dkrt |d}nK|d kr6|j} t|\} }| d | |d zfzt||S) Nr) Collectorz0got empty parameter set %r, function %s at %s:%d)NskipreasonxfailF)r2runfail_at_collectz&Empty parameter set in '%s' at line %d) nodesr.rr#getiniEMPTY_PARAMETERSET_OPTIONMARK_GENr0r3 CollectError LookupError) r*r+r&r.fslinenor2requested_markmarkf_name_s r'get_empty_parameterset_markrC-s"!!!!!T""JB ?   CF]]#<==N+++}}F}++ 7 " "~~V~77 , , ,%% 6$$ 4 7K K   .))) Kr)ceZdZUeeeefed<eeded<e e ed<e ddddededeedfde e d dfd Z e dd edeeefd e d dfdZedee ee fdeedeeefd eee e ffdZedeedeeefd e d edfdZe dee ee fdeedeeefdede d eee edff dZdS) ParameterSetvalues)r,MarkmarksidNrHrIr,r!c t|tr|f}n!t|tjjsJ|Ft|t s"t dt|d|t|}||||S)Nz Expected id to be a string, got z: ) isinstancer, collectionsabcrstr TypeErrortyper)clsrHrIrFs r'paramzParameterSet.paramOs e] + + AHEEe[_%?@@ @ @@ >b#&& W U488 U Ur U UVVVr""Bs65"%%%r)F parameterset force_tuplecpt||r|S|r||S||gdS)ajExtract from an object or objects. :param parameterset: A legacy style parameterset that may or may not be a tuple, and may or may not be wrapped into a mess of mark objects. :param force_tuple: Enforce tuple wrapping so single argument tuple values don't get decomposed and break tests. NrK)rMrT)rSrUrVs r' extract_fromzParameterSet.extract_fromasO" lC ( (    899\** *3|2$777 7r)r+ argvaluesct|tr3d|dD}t|dk}nd}||fS)Nc^g|]*}||+SrJ)strip.0xs r' z8ParameterSet._parse_parametrize_args..s-LLLa!''))L LLLr),r6F)rMrPsplitlen)r+rYargskwargsrVs r'_parse_parametrize_argsz$ParameterSet._parse_parametrize_args~sW h $ $ LL8>>#+>+>LLLHh--1,KKK$$r)c fd|DS)NcHg|]}t|S))rV)rErX)r^r_rVs r'r`z>ParameterSet._parse_parametrize_parameters..s9   FGL % %a[ % A A   r)rJ)rYrVs `r'_parse_parametrize_parametersz*ParameterSet._parse_parametrize_parameterss.     KT    r)r*nodeidc |||\}}|||}~|rz|D]v}t|jt|krOd} t | ||j|t|t|jdwnMt |||} |ttft|z| gd||fS)Nz{nodeid}: in "parametrize" the number of names ({names_len}): {names} must be equal to the number of values ({values_len}): {values})rjrFnames names_len values_lenFpytrace)rFrHrI) rfrircrFrformatrCappendrEr) rSr+rYr&r*rjrV parametersrTmsgr@s r'_for_parametrizezParameterSet._for_parametrizes'!$ ; ;Hi P P+66y+NN   #  u|$$H 55%  #)#(<"*&)(mm'*5<'8'8 #!&     */vxFFD   VIH $=dVPTUUU   ##r))F)r# __module__ __qualname__rrobjectr__annotations__rr rP classmethodrTboolrX staticmethodrrrfrrirrurJr)r'rErEJsh U6:-. //// e34 5555 UW &&&&_j7N1O&PPQ& SM &  &&&[&""88NHV,22 3'$'$'$['$'$'$r)rET)frozencZeZdZUdZeed<eedfed<eeefed<e j ddZ e ded <e j ddZ e eeed < ddd dedeedfdeeefd e dd e eededdfdZdefdZddZdS)rGzA pytest mark.name.rdreNF)defaultrepr_param_ids_from_param_ids_generated _ispytestparam_ids_fromparam_ids_generatedrr!c<t|t|d|t|d|t|d|t|d|t|d|dS):meta private:rrdrerrN)rrx __setattr__)selfrrdrerrrs r'__init__z Mark.__init__s y!!!4...4...462224!2NCCC4!79LMMMMMr)cDd|jvpt|jdkS)Nids)rercrdrs r'_has_param_idszMark._has_param_idss! #:s49~~'::r)otherc |j|jksJd}|jdkr-|r|}n|r|}t|j|j|jzt |jfi|j|dS)zReturn a new Mark which is a combination of this Mark and another Mark. Combines by appending args and merging kwargs. :param Mark other: The mark to combine with. :rtype: Mark N parametrizeT)rr)rrrGrddictre)rrrs r' combined_withzMark.combined_withsyEJ&&&&*. 9 % %##%% &!&$$&& &!% I I "  - - - -)     r))NN)rrGr!rG)r#rvrw__doc__rPryrrr dataclassesfieldrr rrr{rrrrJr)r'rGrGs III S/ CH ): (9$U(S(S(SOXf%SSS4EK4E5555(8C=1,07; N NNNNCHoNS! N !( N &hsm4 NN NNNN&;;;;;      r)rGMarkable.)boundc0eZdZUdZeed<dddededdfdZede fd Z ede e d ffd Z edee e ffd Zede fd ZdededdfdZededefdZedededdfdZdedefdZdS)r,abA decorator for applying a mark on test functions and classes. ``MarkDecorators`` are created with ``pytest.mark``:: mark1 = pytest.mark.NAME # Simple MarkDecorator mark2 = pytest.mark.NAME(name1=value) # Parametrized MarkDecorator and can then be applied as decorators to test functions:: @mark2 def test_function(): pass When a ``MarkDecorator`` is called, it does the following: 1. If called with a single class as its only positional argument and no additional keyword arguments, it attaches the mark to the class so it gets applied automatically to all test cases found in that class. 2. If called with a single function as its only positional argument and no additional keyword arguments, it attaches the mark to the function, containing all the arguments already stored internally in the ``MarkDecorator``. 3. When called in any other case, it returns a new ``MarkDecorator`` instance with the original ``MarkDecorator``'s content updated with the arguments passed to this call. Note: The rules above prevent a ``MarkDecorator`` from storing only a single function or class reference as its positional argument with no additional keyword or positional arguments. You can work around this by using `with_args()`. r@Frrr!Nc2t|||_dS)rN)rr@)rr@rs r'rzMarkDecorator.__init__1sy!!! r)c|jjS)zAlias for mark.name.)r@rrs r'rzMarkDecorator.name6y~r).c|jjS)zAlias for mark.args.)r@rdrs r'rdzMarkDecorator.args;rr)c|jjS)zAlias for mark.kwargs.)r@rers r'rezMarkDecorator.kwargs@syr)c|jS)r)rrs r'marknamezMarkDecorator.marknameEs yr)rdrect|j||d}t|j|dS)zReturn a MarkDecorator with extra arguments added. Unlike calling the MarkDecorator, with_args() can be used even if the sole argument is a callable/class. Tr)rGrr,r@r)rrdrer@s r' with_argszMarkDecorator.with_argsJs? DItVt<<<TY44T::dKKKKr)argcdSNrJrrs r'__call__zMarkDecorator.__call__V r)cdSrrJ)rrdres r'rzMarkDecorator.__call__Zrr)c|rY|sW|d}tj|}t|dkr(t|s|rt ||j|S|j|i|S)zCall the MarkDecorator.rr6)inspectisclassrcr( store_markr@r)rrdrer&is_classs r'rzMarkDecorator.__call__^sv   7Dt,,H4yyA~~:d#3#3~x~4+++ t~t.v...r))r#rvrwrrGryr{rpropertyrPrrrrdr rerrxrr rrrJr)r'r,r, s  D JJJ8=T$ cXeCHoX S)   X #XLvLLOLLLL H    X  f  ?   X /f///////r) consider_mroobjrct|trx|s|jdgg}nd|jD}g}|D]B}t|t r||-||Cn,t|dg}t|t r|}n|g}t t|S)aObtain the unpacked marks that are stored on an object. If obj is a class and consider_mro is true, return marks applied to this class and all of its super-classes in MRO order. If consider_mro is false, only return marks applied directly to this class. pytestmarkcDg|]}|jdgS)r)__dict__getr]s r'r`z&get_unpacked_marks..xs(PPPq!*..r::PPPr)) rMrRrr__mro__listextendrrr%normalize_mark_list)rr mark_lists mark_listitemmark_attributes r'get_unpacked_marksris#t) Q,**<<<=JJPPCKPPPJ  ' 'D$%% '  &&&&  &&&&  ' !lB77 nd + + )&II'(I #I.. / //r)rc#K|D]L}t|d|}t|ts tdt |d|VMdS)z Normalize an iterable of Mark or MarkDecorator objects into a list of marks by retrieving the `mark` attribute on MarkDecorator instances. :param mark_list: marks to normalize :returns: A new list of the extracted Mark objects r@zgot z instead of MarkN)r%rMrGrQr)rr@mark_objs r'rrsp4..(D)) EC4>>CCCDD D r)r@cxt|ts J|gt|d||_dS)zjStore a Mark on an object. This is used to implement the Mark declarations/decorators correctly. FrN)rMrGrr)rr@s r'rrsH dD ! !''4'' !J)#EBBBIDICNNNr)) _ScopeNamecPeZdZededefdZed deddfdZdS) _SkipMarkDecoratorrr!cdSrrJrs r'rz_SkipMarkDecorator.__call__ Cr).r2r,cdSrrJ)rr2s r'rz_SkipMarkDecorator.__call__rr)N.)r#rvrwr rrrPrJr)r'rrss   X        3        r)rc PeZdZ d dddeeefdeeefdedefdZdS) _SkipifMarkDecorator.r1 condition conditionsr2r!cdSrrJ)rrr2rs r'rz_SkipifMarkDecorator.__call__s Cr)Nr)r#rvrwrrPr{r,rrJr)r'rrsy+.     S$Y' sDy)           r)rceZdZededefdZe dddddddeeefdeeefded ed ee e e e e dffd ede fd Zd S)_XfailMarkDecoratorrr!cdSrrJrs r'rz_XfailMarkDecorator.__call__rr).)r2r4raisesstrictrrr2r4rrcdSrrJ)rrr2r4rrrs r'rz_XfailMarkDecorator.__call__s  Cr)Nr) r#rvrwr rrrrPr{r BaseExceptionrr,rJr)r'rrs   X      +. RU   S$Y' sDy)     $}-uT-5H#5M/NNO         r)rceZdZdddddeeeefdeeeeeefdee eefde eeedee e e fe ege effde ed ef d ZdS) _ParametrizeMarkDecorator.)indirectrscoper+rYrrNrr!cdSrrJ)rr+rYrrrs r'rz"_ParametrizeMarkDecorator.__call__s  Cr))r#rvrwrrPrrrErxr{r floatintrrrr,rrJr)r'rrs 47 *-   C#./  lHV4Df&L MN  D(3-/0   U4eS$#>?@cUHV$4457  J'       r)rceZdZdedefdZdS)_UsefixturesMarkDecoratorfixturesr!cdSrrJ)rrs r'rz"_UsefixturesMarkDecorator.__call__ Cr)Nr#rvrwrPr,rrJr)r'rrs6 c m      r)rceZdZdedefdZdS)_FilterwarningsMarkDecoratorfiltersr!cdSrrJ)rrs r'rz%_FilterwarningsMarkDecorator.__call__rr)NrrJr)r'rrs6 S ]      r)rczeZdZUdZereed<eed<eed<e ed<e ed<e ed<dd d e d d fd Z ded efdZd S) MarkGeneratoraFactory for :class:`MarkDecorator` objects - exposed as a ``pytest.mark`` singleton instance. Example:: import pytest @pytest.mark.slowtest def test_function(): pass applies a 'slowtest' :class:`Mark` on ``test_function``. r0skipifr3r usefixturesfilterwarningsFrrr!NcXt|d|_t|_dSr)r_configset_markers)rrs r'rzMarkGenerator.__init__s&y!!!)- "%%% r)rc|ddkrtd|j||jvr}|jdD]b}|dddd}|j|c||jvrm|jjjs|jjj rt|dd |d vrd }td |dtj d|ztdtt|did d S)z:Generate a new :class:`MarkDecorator` with the given name.rrBz*Marker name must NOT start with underscoreNmarkers:(z, not found in `markers` configuration optionFro) parameterize parametrise parameteriseTz Unknown 'z#' mark, did you mean 'parametrize'?zUnknown pytest.mark.%s - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/how-to/mark.htmlrrJr)AttributeErrorrrr8rbr\addoptionstrict_markersrrwarningswarnrr,rG)rrlinemarker__tracebackhide__s r' __getattr__zMarkGenerator.__getattr__su 7c>> !MNN N < #4=(( L// ::..D"ZZ__Q/55c::1=CCEEFM%%f----4=((<&59L9SOOO % JJJ(,%NTNNNOOO IKOP- T$B$???4PPPPr))r#rvrwrrrryrrrrrr{rrPr,rrJr)r'rrs  5    $$$$""""........4444,1(((T(d(((( 'Q'Q 'Q'Q'Q'Q'Q'Qr)rrceZdZdZddZdedefdZded eddfd Zde de fd Z dd e e eefeeeeffdeddfdZdeddfdZdeefdZdefdZdefdZdS) NodeKeywords)nodeparentrrrr!NcH||_|j|_|jdi|_dS)NT)rrrr)rrs r'rzNodeKeywords.__init__5s$ k D) r)keycr |j|S#t$r|j|jj|cYSwxYwr)rKeyErrorrkeywordsrr s r' __getitem__zNodeKeywords.__getitem__:sP -=% % - - -{";', , , , -s $66valuec||j|<dSr)r)rr rs r' __setitem__zNodeKeywords.__setitem__Bs" cr)cB||jvp|jduo ||jjvSrrrr rs r' __contains__zNodeKeywords.__contains__Hs2 4=  ,{$&,t{++ r)rJrkwdsc n|j||j|dSr)rupdate)rrrs r'rzNodeKeywords.updateOs6 U### T"""""r)c td)Nz"cannot delete key in keywords dict) ValueErrorrs r' __delitem__zNodeKeywords.__delitem__Ws=>>>r)c#nK|jEd{V|j|jjD]}||jvr|VdSdSrr)rkeywords r'__iter__zNodeKeywords.__iter__Zse=       ; ";/ " "$-//!MMM # " " "r)c4td|DS)Nc3K|]}dVdS)r6NrJ)r^rs r' z'NodeKeywords.__len__..es"))1))))))r))sumrs r'__len__zNodeKeywords.__len__cs))D))))))r)cd|jdS)Nz)rrs r'__repr__zNodeKeywords.__repr__gs55555r))rrr!N)rJ)r#rvrw __slots__rrPrrrrxr{rrr rrrrrrrr#r&rJr)r'rr1sm.I**** -s-s----#s#3#4####   4    FH##WS#X&sCx(AAB##  ####?s?t????"(3-""""*****6#666666r)r)Ccollections.abcrNrrrtypingrrrrrrr r r r r rrrrrrr_codercompatrrrr_pytest.configr_pytest.deprecatedr_pytest.outcomesr_pytest.warning_typesrr7rr9r{r(rPrCrE dataclassrGrxrRrr,rrr _pytest.scoperrrrrrrrr:rrJr)r'r2s!!!!!! """"""!!!!!!------!!!!!!::::::7RRRRR &sm:s$s$s$s$s$:s$s$s$ld###@ @ @ @ @ @ @ $#@ L 7:U8CK+@$+F%G H H H Z/Z/Z/Z/Z/Z/Z/Z/@000 vt| 00 $Z 0000>dM123 d^"J$J4JJJJ=((((((]}m"M"M} DQDQDQDQDQDQDQDQN =4 ( ( (6666666666>#s(+6666666666r)