bg  ddlZddlZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z ddl mZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#Z#ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl'm)Z)ddl*m+Z+ddl,m-Z-dd l,m.Z.dd!l,m/Z/dd"l,m0Z0dd#l,m1Z1dd$l,m2Z2dd%l,m3Z3dd&l,m4Z4dd'l,m5Z5dd(l,m6Z6dd)l,m7Z7dd*l,m8Z8dd+l,m9Z9dd,l,m:Z:dd-l;mm?Z?dd0l@mAZAdd1l@mBZBdd2lCmDZDdd3lCmEZEdd4lFmGZGdd5lHmIZIdd6lHmJZJdd7lHmKZKdd8lLmMZMdd9lLmNZNdd:lOmPZPdd;lOmQZQddlOmUZUdd?lVmWZWdd@lXmYZYddAlXmZZZe!dBZ[e!dCedDe\fEZ]e"edDe[fedDee[ddfffZ^e"ee[e\dfede\eee_e_efffZ`ejadFGGdHdIee[ZbddMZcdNe$jddOdPdLee"e$jde$jeffdQZfdNe$jgdReQdLee"e$jde$jeffdSZheSeeidTfZjdUe$jedVdWdXdYdLdfdZZkd[e\dLed\fd]Zlee\dDfZmd^e$jddReQdLeemfd_Znd`ee$jddLee$jdfdaZod^e$jddbeeQee$jdeemdfffdceeQeemddffdLdfdeZpd`ee$jddfdbeeQee$jdeemdfffdceeQeemddffdReQdLee$jddff dfZqdgdhdLefdiZrejaGdjdkZsGdldhZte0GdmdnetZue0GdodpevZwGdqdre)ZxdseidLefdtZydudvdgetdLe[fdwZzddxZ{dydzd{eid|e=dLd}fd~Z|e0Gddee[Z}dOe}e[dgetdLdvfdZ~dOe}e[dgeudLe[fdZdee"eee\eegee\ffdLee"eee\dDfeegee\fffdZdeee\dLeee\dDffdZde]dd\dLe]fdZe0ejadFGGdd\Ze9dDdDdDdDdDdde]dRddeee\dedee"eee\eegee\ffdeeidLe]fdZe9 ddDdDdDdDdddddRddeee\dedee"eee\eegee\ffdeeidLefdZ ddddddddee]dRddeee\dedee"eee\eegee\ffdeeidLe"ee]ffdZ ddddddddZedJdgetdLe=fdZde?dLdfdZGddYZdS)N) defaultdict)deque)suppress)Path) TracebackType)Any)Callable)cast)Dict) Generator)Generic)Iterable)Iterator)List)MutableMapping)NoReturn)Optional)Sequence)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union)nodes) getfslineno)FormattedExcinfo) TerminalRepr)TerminalWriter) _format_args)_PytestWrapper) assert_never)final) get_real_func)get_real_method)getfuncargnames) getimfunc) getlocation) is_generator)NOTSET) NotSetType)overload) safe_getattr) _PluggyPlugin)Config)Parsercheck_ispytest) YIELD_FIXTURE)Mark) ParameterSet) MarkDecoratorfail)skip) TEST_OUTCOME) absolutepath) bestrelpath) HIGH_SCOPES)Scope)StashKey)Deque) _ScopeName)Session) CallSpec2)Metafunc FixtureValueFixtureFunction.)boundT)frozenc$eZdZUded<eed<dS)PseudoFixtureDefz"_FixtureCachedResult[FixtureValue] cached_result_scopeN)__name__ __module__ __qualname____annotations__r>a/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/fixtures.pyrJrJjs%7777 MMMMMrRrJsessionrBreturnc.t||_dSN)FixtureManager_fixturemanager)rTs rSpytest_sessionstartrZps,W55GrRnode fixturedefFixtureDef[object]cddlm}|}d|jd}|r?t ||r ||jkr$|j}|rt ||||jk$||jS|S)Nr)Packagez{}/{}z __init__.py)_pytest.pythonr_formatbaseid isinstancenodeidparentrT)r[r\r_currentfixture_package_names rSget_scope_packagerhts'&&&&&<@G">>**;]KK ! w ( (!,@GN,R,R. ! w ( (!,@GN,R,R| NrRscopecddl}|tjur|tjS|tjur||jjS|tjur||jjS|tj ur||jj S|tj ur||j j St|dS)Nr) r`r>Function getparentrItemClasspythonModuler_rBmainr")r[ri_pytests rSget_scope_noderss ~~ej))) %+  ~~gn2333 %,  ~~gn3444 %-  ~~gn4555 %-  ~~gl2333UrRFixtureDef[Any] collectormetafuncrDfixturemanagerrXc |jdjsdSi}i}|jD]}|jD]\}}||jvsJ||j|<||g}t ||j|<||||vr*|j |tj } | ||<|j |j } |D]\}} ||} d} | tj urCt|| } | 1| tjurt!|t"jjsJ|} | d} n"i}| jt*|} | || vr | |g| |<t-|d|t.||| dd}|g| |<| || |<dS)NrFrwrbargnamefuncriparamsunittestids)_callsfuncargsitemsr} setdefaultlenindicesappend _arg2scopegetr>rkclear_arg2fixturedefsrsrnrcrrrorpstashname2pseudofixturedef_key FixtureDefget_direct_param_fixture_func)rurvrw arg2params arg2scopecallspecr{argvaluearg2params_listriarg2fixturedefs valuelistr[name2pseudofixturedefdefaultr\s rSadd_funcarg_pseudo_fixture_defrsC ?1  &*,J"$IO " "!)!2!8!8!:!: + + GX(/1111'/HOG $(33GR@@O(+O(<(rkrsortedrrrrBr_pathrerprnclsr"AttributeError)rrircsr{ param_indexkeyitem_clss rSget_parametrized_fixture_keysrs2  & & & &=!%+2:+;+;+=+=$>$>   G[}W%.. %%$k2%-'' TY-=>%,&& TY7%+%%8 TYAU###IIII        sC C)(C)rci}i}tD]w}i}|||<tt}|||<|D]R}tt ||d}|r%|||<|D]}|||Sxt|d} tt| ||tj SrW) r=rrdictfromkeysrrlistreorder_items_atscoper>rB) r argkeys_cacheitems_by_argkeyriditem_drkeysr items_dicts rS reorder_itemsrsEGMBDO - -02 e0;E0B0B!' - -D==!>tU!K!KTRRD -$--C3K&&t,,,,  - ud++J j-%-XX  rRrrzDeque[nodes.Item]ctD]B}|||gD]#}||||$CdSrW)r=r appendleft)rrrrirs rSfix_cache_orderr'sg 99 '++D"55 9 9C E "3 ' 2 24 8 8 8 8 999rRc|tjustdkrStt }i}||}||}|ri}d} |r|} | |vs| |vrt fd|| gDd} | sd|| <nd| \} } fd|| D} t| D](}t|||| |)n||r.t||||}|D]} d|| <| ||S)Nc3$K|] }|v|V dSrWrQ).0kignores rS z(reorder_items_atscope..Fs'RRq!6//////RRrRcg|]}|v| SrQrQ)rirs rS z)reorder_items_atscope..Ns%"""eArR)r>rkrsetrpopleftrrrpopitemreversedrrr next_loweradd)rrrri items_deque items_donescoped_items_by_argkeyscoped_argkeys_cacheno_argkey_groupslicing_argkeyrargkeys_matching_itemsrrs` @rSrr1s  #e**q.. "%%%F,,K)+J,U3(/ #24 &&((Dz!!T_%<%<mmRRRR044T2>>RRRTXG (,%%$+OO$5$5!""""5nE"""".11..A#A}oFFF**1----' (  (3AQAQASASO( ( (#' 4   >"""; #< rRrequestFixtureRequestc|jSrW)paramrs rSrr_s =rRceZdZUdZeedfed<eedfed<eeed<eee dfed<d d Z d S) FuncFixtureInfo)argnames initialnames names_closurename2fixturedefs.rrrrtrrUNcpt}t|j}|rl|}||vrR||jvrI||||jvr+||j|dj|lt||jj |jdd<dS)aRecompute names_closure from initialnames and name2fixturedefs. Can only reduce names_closure, which means that the new closure will always be a subset of the old one. The order is preserved. This method is needed because direct parametrization may shadow some of the fixtures that were included in the originally built dependency tree. In this way the dependency tree can get pruned, and the closure of argnames may get reduced. )rN) rrpoprrrupdaterrindex)selfclosure working_setr{s rSprune_dependency_treez%FuncFixtureInfo.prune_dependency_treeps EE$+,,  T!oo''G g%%'T5G*G*G G$$$d333&&t'rkrL _fixture_defs _fixtureinforcopyr _arg2indexrTrY)r pyfuncitemr fixtureinfos rS__init__zFixtureRequest.__init__spy!!!%*.n 9;'1'> + < A A C C*,/9/A/Q rRrAc|jjSzIScope string, one of "function", "class", "module", "package", "session".rLvaluers rSrizFixtureRequest.scope{  rRct|jjj}|t |j||S)z-Names of all active fixtures in this request.)rrrrextendrr difference)rresults rS fixturenameszFixtureRequest.fixturenamessJd&3ABB c$,--88@@AAA rRc4|j}|tjur|j}n>|tjurt |j|j}nt|j|}||tjur|j}|s#Jd ||j|S)z>Underlying collection node (depends on current request scope).Nz8Could not obtain a node for scope "{}" for function {!r}) rLr>rkrr_rh _fixturedefrsrnra)rrir[s rSr[zFixtureRequest.nodes  EN " "AEAQDD em # #%T%5t7GHHDD!$"2E::D >  #*666'.5H.==gxPPK.9D !' *##GQ//!3  E6C ,<,<#<#<$Wd33 3#( 5!!rRc|jjS)z6The pytest config object associated with this request.)rconfigrs rSr zFixtureRequest.configs&&rRc`|jdkrtd|jd|jjS)z=Test function object if the request has a per-function scope.functionzfunction not available in -scoped context)rirrrrs rSr zFixtureRequest.functionsA : # # HTZHHH ##rRc|jdvrtd|jd|jtjj}|r|jSdS)z:Class (can be None) where the test function was collected.)classr zcls not available in r N)rirrrlrrrornr)rclscols rSrzFixtureRequest.clssc :2 2 2 !T!T!T!TUU U!++GN,@AA  :   rRc |jjS#t$r%t|dd}t|ddcYSwxYw)zrk_compute_fixture_value)rr{r\rKs rSr.z%FixtureRequest._get_active_fixturedefPs %g. .    !44W== %   i''%)A3$5M+M5>JJJJJJJ     ##J///&07#s/  A,0A,0A& A,$A&&A,+A,c|}g}t|tr6||j|j}t|t6||SrW)rc SubRequestrr_parent_requestreverse)rrfvaluess rS_get_fixturestackz FixtureRequest._get_fixturestackcsf(**-- . MM'- . . .-G*-- .  rRr\c|j}|j}|j} |j}n#t$rd}YnwxYw|^||jvrU|j|}|j|}tt5|j |}dddn #1swxYwYnZt}d}|jdu}t|dd} |rG| rEd |j |jt|j} t#| d|rt%jd} t%j| d} t+| j} | j} t1| |jj}n#t8$rt1| }YnwxYwd |j|jt;|j|jj||} t#| dt?|||||d }| ||j| |!| |"||dS#|"||wxYw) a+Create a SubRequest based on "self" and call the execute method of the given FixtureDef object. This will force the FixtureDef object to throw away any previous results and compute a new fixture value, which will be stored into the FixtureDef object itself. Nr nofuncargsFzo{name} does not support fixtures, maybe unittest.TestCase subclass? Node id: {nodeid} Function type: {typename})namerdtypenamepytracerz}The requested fixture has no parameter defined for test: {} Requested fixture '{}' defined in: {} Requested here: {}:{}Trr)#r{rrLrrr}rrr0rr*rrar:rdtyperMr8inspectstack getframeinfor;filenamelinenor relative_tor rootpath ValueErrorr(r|r3 _check_scopeexecute_schedule_finalizers)rr\r{funcitemrirrr has_paramsfixtures_not_supportedr'frame frameinfo source_path source_linenosource_path_str subrequests rSr1z%FixtureRequest._compute_fixture_valuels$#! (HH   HHH   Gx$>$>OG,E"*73K(## 5 5 +G4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5EK#*$6J%,X|U%K%K " )4 )0&!#?!(^^4 S%(((( ) *#0q:: *9+=>> ) 0 7&)#//0HII''OO"777&)+&6&6OOO7128 "*#JOX_5MNN'% 22 S%(((( % Z4   e<<< >   z  2 2 2  % %j* = = = = =D % %j* = = = =s< ..*BB B,E;;FFI I#rRr3cFjfddS)Nc0SNr)finish)r\rRsrSz5FixtureRequest._schedule_finalizers..sZ->->z->-R-RrRr )rr\rRs ``rSrIz#FixtureRequest._schedule_finalizerss/ $$%R%R%R%R%RSSSSSrRinvoking_scoperequested_scopec |dkrdS||krPd|}td|jd|d|jd|ddSdS) Nr z'ScopeMismatch: You tried to access the z scoped fixture z with a z, scoped request object, involved factories: Fr<)join_factorytracebackr8r)rr{rXrYtexts rSrGzFixtureRequest._check_scopes i   F O + +99T335566D //:O//"//,:,@//(,//        , +rRcBg}|D]}|j}t|\}}t|tr"|jj}t|j|}n|}t|}| d||dz|j |fz|S)Nz%s:%d: def %s%sr) r7r|rrcrrrTr<rr rrM) rlinesr\factoryfsrCrTpargss rSr]z FixtureRequest._factorytracebacks0022 W WJ oG$W--JB"d## #'#3#; b11((D LL+q&1*g>NPT.UU V V V V rRcd|jzS)Nz)r[rs rS__repr__zFixtureRequest.__repr__s(DI66rRrUrA)rUrBr)r\r]rUNr\r]rRr3rUN)-rMrNrO__doc__boolrpropertyrirrrr[rr/r r rrrrrrrrrTr objectr!rr6r&rrr)r,r+rJr.r7r1rIr>rGr]rfrQrRrSrrs9>$*!!!X!d3iX X("#"2C""""&''''X'$$X$X77X7EEXE %d%%%X%.c2X (((X(*hr6z&:*t**** %%](:"; % % % % %GhsmGGGGGGGGG+s+s++++0 #%5f%== >&4(9#:K>K>K>K>ZT.T)rrrs rSrfzSubRequest.__repr__s!Ld.LLt7GLLLLrRrc:|j|dSr)rr!r"s rSr!zSubRequest.addfinalizers! %%i00000rRrRc|j|jvr3|tj|jj|t||dSrU) r{rr! functoolspartialrrVsuperrI)rr\rR __class__s rSrIzSubRequest._schedule_finalizerssi  T%6 6 6  # #!$"2"94HHH    $$Z<<<<rintrjrrrfr rlr!rI __classcell__)rvs@rSr3r3s TT 777!77 7  7 ) 77 77770M#MMMM1hr6z&:1t1111 =. =.$s16rRrzfile z, line rz defz+file %s, line %s: source code not availablez5 recursive dependency involving fixture '{}' detectedz fixture 'z ' not foundz available fixtures: {}z, z6 use 'pytest --fixtures [testpath]' for help on them.)!rrrrrmapr{r'rr?getsourcelinesr$ enumeraterstriplstrip startswithOSError IndexError TypeErrorrYrrerdrrr_matchfactoriesrr{rar\rr|)rtblinesaddliner@r'r fspathrCr`rrline error_msgfm availablerr:rfaclists rS formatreprzFixtureLookupError.formatrepr s.)-. S))4+<==>>>h ?#2#JE  H(22NFF "1-2I2IJJq ;;;vz;;<<<(//GAt;;==DGD4K((({{}}//66Z3 : : :I  VVaZ$8899999 : ;-BI|/6=H%'%8%>%>%@%@ ( (!kr11+xHHII(MM$'''|y((MTTL<$,;;; .55diiy@Q@Q6R6RSS SC L LC%ffgsDLQQQs/$D,D76D7rW)rUr|) rMrNrOrirrrrrrQrRrSrrs|DDUY}/=DLSM *R*R*R*R*R*RrRrc feZdZdeedfdedeededeeddf d Zd e ddfd Z dS) r|rBzos.PathLike[str] firstlinenor errorstringr{rUNcL||_||_||_||_||_dSrW)rrrBrr{)rrBrrrr{s rSrzFixtureLookupErrorRepr.__init__Ns- &  & rRtwc@|jD])}||*|jd}|r|t jd|dd|ddD]:}|t jd|d;||dtj |j |j dzfzdS)Nr[z rT)redrz%s:%d) rrrrsplitr fail_markerstrip flow_markerosrrBr)rrtbliner`rs rS toterminalz!FixtureLookupErrorRepr.toterminal\s+l % %F GGFMMOO $ $ $ $ &&t,,   GG#/JJa8H8HJJ    abb   '3JJDJJLLJJ   29T]33T5E5IJJKKKKKrR) rMrNrOrrrwrrrrrrQrRrSr|r|Ms //0  #    #      L^LLLLLLLrRr|r'ct|\}}|d|dz}tj|}t |dzt |zdz|zddS)N:rz: r[Fr<)rrr_codeSourcer8rindent) fixturefuncr'rbrClocationsources rSfail_fixturefuncros{[))JB##vz##H ] ! !+ . .FwV]]__-- - 4x ?OOOOOOrRr_FixtureFunc[FixtureValue]ct|rttdttddff|}|di|} t |}n&#t $rt|jddwxYwtj t||}| |n*ttdtf|}|di|}|S)N.z did not yield a valuerQ) r)r r r rEnext StopIterationrFrrsrt_teardown_yield_fixturer!)rrkwargs generatorfixture_resultrs rScall_fixture_funcrvsK  / S)L$$<== >    K))&))  W!)__NN W W W 3KKKLLRV V W%&={IVV Y''''8C$56 DD $..v.. s A#A<ch t|t|ddS#t$rYdSwxYw)zExecute the teardown of a fixture function by advancing the iterator after the yield and ensure the iteration ends (if not it means there is more than one yield in the function).z*fixture function has more than one 'yield'N)rrr)rits rSrrsPT R &RSSSSS      s # 11scope_callablez#Callable[[str, Config], _ScopeName] fixture_namer rAc |||}n6#t$r)}td|||d}~wwxYwt|ts&t d|||d|S)N)rr zqError evaluating {} while defining fixture '{}'. Expected a function with the signature (*, fixture_name, config)zPExpected {} to return a 'str' while defining fixture '{}', but it returned: {!r}Fr<) Exceptionrrarcrr8)rrr res rS_eval_scope_callablers  \&III  OOUv PP     fc " "   6.,??    Ms  A$>AcZeZdZdZ ddddeededd d eed eee gd fdfd ee e d e deee ee dfeegee ffddfdZeddZdege fddfdZdeddfdZdedefdZdede fdZdefdZdS)rz%A container for a fixture definition.FNrwrXrbr{r|rrirAr}r~r.rUc ||_|pd|_|du|_||_||_| t j}n%t|rt|||j }t|tr t j |d|j d|}||_||_||_t#||||_||_d|_g|_dS)Nryz Fixture '')descrwhere)r: is_method)rYrb has_locationr|r{r>rkcallablerr rcr from_userrMrLr}rr&rr~rK _finalizers) rrwrbr{r|rir}r~rs rSrzFixtureDef.__init__s .l #$.  =NEE e__ P(9NOOE eS ! ! O9999E 28 '7hOOO ! LP79rRc|jjSrrrs rSrizFixtureDef.scoperrRrc:|j|dSrW)rrr"s rSr!zFixtureDef.addfinalizers  *****rRrcd} |jrG |j}|n#t$r}||}Yd}~nd}~wwxYw|jG|r| |jj}|||d|_g|_dS#|jj}|||d|_g|_wxYw)Nr\r)rr BaseExceptionr[ihookpytest_fixture_post_finalizerrK)rrexcr|rrs rSrVzFixtureDef.finishs ""  +//11DDFFFF$   {  "    L&E  / /4 / Q Q Q"&D !D    L&E  / /4 / Q Q Q"&D !D  ! ! ! !s/B #0B AAB AB 3B=c:|jD]b}||}|dkrEt|tsJ|t j|j|c||}|j q|j d}||urB|j d&|j d\}}}| ||j d} | S|||j J|j j } | ||} | S)Nrrrrr)rr.rcrr!rsrtrV cache_keyrKwith_tracebackr[rpytest_fixture_setup) rrr{r\ my_cache_keyrrvaltbrrs rSrHzFixtureDef.executes7} Y YG 77@@J)##!*j99999'' (9$+w(W(W(WXXX~~g..   )*1-Iy((%a(4!%!3A!6JAsB,,R000!/2F!M KK %--- "++tW+MM rRc>t|ds|jn|jS)Nr)hasattrrr)rrs rSrzFixtureDef.cache_key0s!*1'7*C*CVw""VrRcNd|j|j|jS)Nz0)rar{rirbrs rSrfzFixtureDef.__repr__3s'AHH L$*dk   rR)FNrg)rMrNrOrirrrr>r r/rrlrjrrrrkrir!r3rVrErHrrfrQrRrSrrs// =:=:(=: =: =: + =: UL(C=,3N*OQUUV =:&)*=:=: %(#-.#@P9P0QQ R =: =:=:=:=:~!!!X!+hr6z&:+t++++"j"T"""".zl>WWWWWW #      rRrcR|j}|jr'|j|j|j}nq|jjt |dr!t |j|jjs|St|j}||jkr||j}|S)zGet the actual callable that can be called to obtain the fixture value, dealing with unittest-specific instances and bound methods.Nr) r|r~r__get__rrcrrvr')r\rrs rSresolve_fixture_functionr9s /KD   '$/11'2BCCK   '{J// #  +"6"@99 ##"#JO44Kjo--)11'2BCC rRc:i}|jD]Q}||}|jJ|j\}}}|||j|j|||<Rt ||}||} t|||}n}#t$rptj } | dJt| dtj r'|jds d| d_d| | f|_wxYw|| df|_|S)zExecution of fixture setup.Nrr xunit_setupT)rr.rKrGrLrrrr:sysexc_inforcr9rrMr_use_item_location) r\rrr{fixdefr arg_cache_keyrrrrs rSrrTsOF&!!//88#///%+%9" sWgnfmDDD w*:w??K''00L ";@@ <>>{&&&  QK   2&11-@@ 2.2HQK *$(,#A   !' d;J Ms BA:DrcJ|dSt|r|St|SrW)rtuple)rs rS_ensure_immutable_idsrqs- {t}} ::rRr}c(|t|ndSrW)r)r}s rS_params_converterr{s#.5===D8rRr fixture_markercd|jp|jtj|fd}t ||_tt|S)zWrap the given fixture function so we can raise an error about it being called directly, instead of used as an argument in a test function.asFixture "{name}" called directly. Fixtures are not meant to be called directly, but are created automatically when test functions request them as parameters. See https://docs.pytest.org/en/stable/explanation/fixtures.html for more information about fixtures, and https://docs.pytest.org/en/stable/deprecations.html#calling-fixtures-directly about how to update your code.r:c*tddS)NFr<r7)rdrmessages rSrz=wrap_function_to_error_out_if_called_directly..results We$$$$$$rR) rar:rMrswrapsr!__pytest_wrapped__r rF)r rrrs @rS-wrap_function_to_error_out_if_called_directlyrs| w f.%:):f;;  _X%%%%% !/x 8 8F  ( ((rRceZdZUded<eeedfed<dZeed<dZ ee eeedfe e geeffed<dZ eeed <dZejeed <d ed dfd Zd ed efdZdS)r6Union[_ScopeName, Callable[[str, Config], _ScopeName]]ri.r}FautouseNrr:rrUc$t|dSrWr1)rrs rS __post_init__z#FixtureFunctionMarker.__post_init__sy!!!!!rRr cHtj|rtdt|ddrtdt ||}|jp|j}|dkr3t|}td |d||_ |S)Nz2class fixtures not supported (maybe in the future)rFz`` and then use ``@pytest.fixture(name='')``. NT)rir}rrr:r)rrr)rrir}rrr:rs rSrrsxz+ & 2uV}}}KDDHSMM%ISSuSzz  N0~./// rRc `tjtdt|g|R|||||dS)z(Return a) decorator to mark a yield-fixture factory function. .. deprecated:: 3.0 Use :py:func:`pytest.fixture` directly instead. r) stacklevelr)warningswarnr3r)rrir}rrr:rds rS yield_fixturer.sV M-A....          rR)ric|jS)zSession-scoped fixture that returns the session's :class:`pytest.Config` object. Example:: def test_foo(pytestconfig): if pytestconfig.getoption("verbose") > 0: ... )r rs rS pytestconfigrHs  >rRparserc8|ddgddS)N usefixturesrdz5List of default fixtures to be used with this project)r>rhelp)addini)r s rSpytest_addoptionrWs3 MM  D rRceZdZdZeZeZd&dZdejde e fdZ d'dejd e de fd Zd eddfd Zde dee fdZ d(dee dfdejdee deee dfe e ee eeefffdZd)dZde ejddfdZedddejde ddfdZedddedee de ddfdZe fd dde!ejefde!e e"dfde ddfd!Zd"e de deeeefd#Z#d$e$eede deeefd%Z%dS)*rXapytest fixture definitions and information is stored and managed from this class. During collection fm.parsefactories() is called multiple times to parse fixture function definitions into FixtureDef objects and internal data structures. During collection of test functions, metafunc-mechanics instantiate a FuncFixtureInfo object which is cached per node/func-name. This FuncFixtureInfo object is later retrieved by Function nodes which themselves offer a fixturenames attribute. The FuncFixtureInfo object holds information about fixtures and FixtureDefs relevant for a particular function. An initial list of fixtures is assembled like this: - ini-defined usefixtures - autouse-marked fixtures along the collection chain up from the function - usefixtures markers at module/class/function level - test function funcargs Subsequently the funcfixtureinfo.fixturenames attribute is computed as the closure of the fixtures needed to setup the initial fixtures, i.e. fixtures needed by fixture functions themselves are appended to the fixturenames list. Upon the test-setup phases all fixturenames are instantiated, retrieved by a lookup of their FuncFixtureInfo. rTrBrUNc||_|j|_i|_t|_d|jdi|_|jj|ddS)Nryr  funcmanage) rTr rr_holderobjseengetini_nodeid_autousenames pluginmanagerregister)rrTs rSrzFixtureManager.__init__sj %n BD+.55  ""=11; ! $--dLAAAAArRr[cg}|dD]P}|jdds3tj|ji|j\}}||Q|S)a!Return all direct parametrization arguments of a node, so we don't mistake them for fixtures. Check https://github.com/pytest-dev/pytest/issues/5036. These things are done later as well when dealing with parametrization so this could be improved. parametrizerindirectF) iter_markersrrr5_parse_parametrize_argsrdr)rr[parametrize_argnamesr# p_argnamesrs rS_get_direct_parametrize_argsz+FixtureManager._get_direct_parametrize_argss+-'']';; 8 8F=$$Z77 8 , D[!$*M!! A%++J777##rRTrcZ|r)t|ddst||j|}nd}td|dD}||z}|jj}|||||\}} } t||| | S) Nr9F)r:rrQc3.K|]}|jD]}|VdSrW)rd)rmarkargs rSrz0FixtureManager.getfixtureinfo..sI  TY  FIC       rRr r) ignore_args) rr&r:rrrTrYgetfixtureclosurerr) rr[r|rrrr rrrrs rSgetfixtureinfozFixtureManager.getfixtureinfos  GD,>> &t$)EEEHHH   --=-AA     #X- \ )797K7K $D,M,Md,S,S8L8 8 4 m_x}oVVVrRplugincd} t|j}|jdr t |j|jj}n#t$rd}YnwxYw|dkrd}tj tj kr*|tj tj }n#t$rYnwxYw|||dS)Nz conftest.pyry.)r;__file__r:rrrerDr rErFrseprSEPreplacerparsefactories)rr&rdrcs rSpytest_plugin_registeredz'FixtureManager.pytest_plugin_registereds ?V_--Av  // ?  !5!5dk6J!K!KLLFF!   FFF S==F6UY&&#^^BFEI>>F    D  FF+++++s"C1A%% A43A4 CCrdc#Ktj|D]&}|j|}|r|Ed{V'dS)z:Return the names of autouse fixtures applicable to nodeid.N)riterparentnodeidsrr)rrd parentnodeid basenamess rS_getautousenameszFixtureManager._getautousenamessa!3F;; % %L155lCCI %$$$$$$$$ % %rRrQr. parentnoder#c |j}t|| dttddf fd }||t }i d}|t krdt } D]?}||vr| vr |||} | r| |<|| dj@|t kddtdtf fd } | d| fS) N otherlistrUcD|D]}|vr|dSrW)r)r6r"fixturenames_closures rSmergez/FixtureManager.getfixtureclosure..merges=  5 5222(//444 5 5rRrarg_namech |}|djS#t$rtjcYSwxYw)Nr)rLr0r>rk)r:rrs rS sort_by_scopez7FixtureManager.getfixtureclosure..sort_by_scopesL .-h7 #2-- & & &~%%% &s 11T)rr5) rdrr3rrrrrrr>sort) rrr4r#rr9rlastlenr{rr<rr8s @@rSr$z FixtureManager.getfixtureclosures}$#D$9$9($C$CDD 5Xc] 5t 5 5 5 5 5 5 l 122 @B12222.//G/ 4 4k))o--"11'8DD 4/:OG,E+b/233312222 .C .E . . . . . . !!mT!BBB1?BBrRrvrDc dtdttfd|jD]|j}|st fd|jdDrTt|D]?}|j +| |j d|j |j n |jvrn@dS) zLGenerate new tests based on parametrized fixtures used by the given metafuncr!rUcBtj|ji|j\}}|SrW)r5rrdr)r!rdrs rSget_parametrize_mark_argnameszKFixtureManager.pytest_generate_tests..get_parametrize_mark_argnamess$":DIUUUGD!KrRc32K|]}|vVdSrWrQ)rr!r{rAs rSrz7FixtureManager.pytest_generate_tests..sH88>>>rRrNT)rrir)r4rrrrrany definitionrrr}rrirr)rrv fixture_defsr\r{rAs @@rSpytest_generate_testsz$FixtureManager.pytest_generate_testss9  #     ," " G#488AAL $/<<]KK  '|44   $0((")!%(.&N )E*"555E6C" " rRrc.t||dd<dSrW)r)rrs rSpytest_collection_modifyitemsz,FixtureManager.pytest_collection_modifyitems1s ''aaarR)r~ node_or_objr~ctrWNotImplementedError)rrIr~s rSr-zFixtureManager.parsefactories5s"###rRctrWrK)rrIrdr~s rSr-zFixtureManager.parsefactories>s"###rRFc |tur|}nYt|tjsJt t |j}t|jtsJ|j}||j vrdS|j |g}t|D]!}t|tjr|dkr$t||d}t|}t|tsZ|jr|j}t!||}t#|||||j|j||j} |j|g} | jr| | n/t3d| D} | | | |jr||#|r2|j|pdg|dSdS)awCollect fixtures from a collection node or object. Found fixtures are parsed into `FixtureDef`s and saved. If `node_or_object` is a collection node (with an underlying Python object), the node's object is traversed and the node's nodeid is used to determine the fixtures' visibilty. `nodeid` must not be specified in this case. If `node_or_object` is an object (e.g. a plugin), the object is traversed and the given `nodeid` is used to determine the fixtures' visibility. `nodeid` must be specified in this case; None and "" mean total visibility. Nrrzc g|] }|j | SrQ)r)rfs rSrz1FixtureManager.parsefactories..sBBBq1>BBBBrRry)r*rcrNoder rlrrdrrrdirr-rrr:r%rrir}rrrrrrinsertrrr) rrIrdr~ holderobj autousenamesr:rr# fixture_defrrs rSr-zFixtureManager.parsefactoriesHs$*   #IIk5:66 6 66V[_55Ik0#66 6 66 'F + + + F  ***  NN. *. *D)UZ00 TX5E5Ey$55C%c**Ff&;<< { #{ "#y11C$#l}!J   K+66tR@@G' /{++++ BBGBBBCCq+...~ *##D)))  X  % 0 02r B B I I, W W W W W X XrRr{c |j|}n#t$rYdSwxYwt|||S)zGet a list of fixtures which are applicable to the given node id. :param str argname: Name of the fixture to search for. :param str nodeid: Full node id of the requesting test. :rtype: Sequence[FixtureDef] N)rr0rr)rr{rdrs rSrzFixtureManager.getfixturedefssV /8KK   44 T))+v>>???s  rc#pKttj|}|D]}|j|vr|VdSrW)rrr0rb)rrrd parentnodeidsr\s rSrzFixtureManager._matchfactoriessTE3F;;<< % ! !J M11     ! !rRrTrBrUN)T)rQ)rvrDrUN)&rMrNrOrirr|rrrQrrrrjrr%r.r.rr3rrr rrr$rFrmrHr,r-rlrr*rr+rrrrQrRrSrXrX`sa<,3 B B B B$$S $$$$(=AWWJW59W WWWW$,},,,,,,%s%x}%%%%&( 3C3CCHo3CJ3Cc] 3C uS#XS 4Xjo5N0N+OO P 3C3C3C3Cj))))Z(4 3C(((((  $$$Z$ $  $$$X$  $$$$ $  $  $$$X$06RX  RXRXRX5:v-.RXc:t+,RX  RX  RXRXRXRXh @ @$' @ (:c?+ , @ @ @ @!#JsO4!>A! *S/ "!!!!!!rRrZr).rW)rrsr?rrr collectionsrr contextlibrpathlibrtypesrtypingrr r r r r rrrrrrrrrrrrrrrr _pytest._coder_pytest._code.coderr _pytest._ior_pytest.compatr r!r"r#r$r%r&r'r(r)r*r+r,r-_pytest.configr.r/_pytest.config.argparsingr0_pytest.deprecatedr2r3 _pytest.markr4r5_pytest.mark.structuresr6_pytest.outcomesr8r9r:_pytest.pathlibr;r< _pytest.scoper=r> _pytest.stashr?r@rA _pytest.mainrBr`rCrDrErlrF _FixtureFuncr_FixtureCachedResult dataclassrJrZrm CollectorrhrQrsrrrr_Keyrrrrrrrr3 LookupErrorrr|rrrrrrrrrrrrjrrrrrXrQrRrSrtsO ######!!!!!! %%%%%%//////++++++&&&&&&''''''))))))'''''' ((((((************$$$$$$&&&&&&''''''!!!!!!%%%%%%######''''''((((((!!!!!!,,,,,,------,,,,,,%%%%%%111111!!!!!!!!!!!!))))))((((((''''''%%%%%%""""""((((((($$$$$$((((((''''''w~&& '+8CK3HIII S, #ytT9Q/R*R!SS       d=!=-?@  B $d###w|,$# 6666 *$eEJ/01" *" eEJ/01(CHT#/@*@%ABDDC<C<*4C