j7iIMdZddlmZddlZddlmZddlZddlZddlZddl Z ddl m Z ddl m Z ddl m Z ddl mZdd l mZdd l mZd d lmZd d lmZd dlmZd dlmZd dlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%ddl"m&Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*ddl'm+Z+ejXdkrdd l-m.Z.er dd!l/m0Z0dd"l1m2Z2dd%Z5d>d&Z6d?d'Z7 d@ dAd)Z8dBd*Z9dBd+Z:dBd,Z;dCd-Z< dDd.Z=dEd/Z> dF dGd0Z?dHd1Z@dId2ZAed3d(4ZBe ejGd5d6e eBZDdJd7ZEdKd8ZFGd9d:ZGdKd;ZHy)Lz3Basic collect and runtest protocol implementations.) annotationsN)Callable)cast)final)Generic)Literal) TYPE_CHECKING)TypeVar)Config) BaseReport)CollectErrorRepr) CollectReport) TestReport)timing)ExceptionChainRepr) ExceptionInfo) TerminalRepr)Parser)check_ispytest) Collector) Directory)Item)Node)Exit)OutcomeException)Skipped) TEST_OUTCOME) )BaseExceptionGroup)Session)TerminalReporterc|jddd}|jddtddd |jd dtddd y) Nzterminal reporting Reportinggeneral)afterz --durationsstoreNz1Show N slowest setup/test durations (N=0 for all))actiontypedefaultmetavarhelpz--durations-minzcMinimal duration in seconds for inclusion in slowest list. Default: 0.005 (or 0.0 if -vv is given).)getgroup addoptionintfloat)parsergroups W/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/runner.pypytest_addoptionr63sa OO0+YO OE OO  @  OO 3 cp|jjj}|jjj}|jj }|y| |dkrdnd}|}g}|j j D]'}|D] }t|ds|j|")|sy|jdd|s|jdd n|jdd |d |d|}t|D]\}}|j|krd|jd d t||z d|dd} |jjj| dz } | dz } |j| y|j|jdd|jdd|j y)Ng{Gzt?gdurationc|jSN)r:)xs r5z)pytest_terminal_summary..Xs QZZr7T)keyreverse=zslowest durationszslowest z durations(z durations < gz s hidden.z" Use -vv to show these durations.)z02.2fzs z<8 )configoption durations durations_min get_verbositystatsvalueshasattrappendsort write_sep enumerater: write_linelenwhennodeid) terminalreporterrIrJverbosetrdlistreplistrepimessages r5pytest_terminal_summaryr_Hs ''..88I$++22@@M%%335G!(1# B E88??$" "CsJ' S! ""  JJ'J6  S-. SHYKz:;jy!E" K3 <<- ' MM" #e*q.)}Q6GyQG&&--;;C?? sNG MM' "  e,Bsxxm1SZZLIJ Kr7c"t|_yr<) SetupState _setupstatesessions r5pytest_sessionstartreks $,Gr7c:|jjdyr<)rbteardown_exactrcs r5pytest_sessionfinishrhos &&t,r7c|j}|j|j|jt |||j |j|jy)N)rVlocationnextitemT)ihookpytest_runtest_logstartrVrjruntestprotocolpytest_runtest_logfinish)itemrlrms r5pytest_runtest_protocolrrssN JJE !!t}}!MD8, ""$++ "N r7Tct|d}|r|js|jt|d|}|g}|jr_|j j ddr t||j j dds|jt|d||jjs|jjrd}|jt|d|||rd|_d|_ |S) N_requestsetup setupshowF setuponlycallteardownrk) rNrt _initrequestcall_and_reportpassedrG getoptionshow_test_itemrOrd shouldfail shouldstopfuncargs)rqlogrl hasrequestr\reportss r5roro{sz*J$--  $ -CeG zz ;; e 4 4 {{$$[%8 NN?4= > ||$,,"9"9 NN?4S8LM  Nr7c^|jj}|j|jd|j|jt t |dg}|r/|jdjdj||jy)zAShow test function, parameters and the fixtures of the test item.z fixturenamesz (fixtures used: {})z, N) rGget_terminal_writerlinewriterVsortedgetattrformatjoinflush)rqtw used_fixturess r5r~r~sy  ( ( *BGGIHHWHHT[[74<=M '..tyy/GHIHHJr7cft|d|jjj|y)Nru)_update_current_test_varrdrbru)rqs r5pytest_runtest_setuprs$T7+LL""4(r7ct|d t`t`t`tj dk\rt` |jy#t$rYwxYw#t$rp}t|t_|t_tj dk\r |t_|jJ|jjt_d}~wwxYw)Nrx)r r) rsys last_type last_valuelast_traceback version_infolast_excAttributeErrorruntest Exceptionr+ __traceback__tb_next)rqes r5pytest_runtest_callrsT6* M N     z )         Q    z )CL***__44  s)+A A AA C#A+CCc~t|d|jjj|t|dy)Nry)rrdrbrg)rqrls r5pytest_runtest_teardownrs.T:.LL++H5T4(r7cd}|r8|jd|d}|jdd}|tj|<ytjj |y)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 (rEz(null)N)rVreplaceosenvironpop)rqrUvar_namevalues r5rrsP%H ;;-r$q) fh/$ 8 x r7cV|jdvr|jry|jryyy)N)rury)errorEERROR)skippedsSKIPPED)rBrBrB)rUfailedrreports r5pytest_report_teststatusrs) {{++ ==( ^^, r7c j}|dk(r |jn.|dk(r |jn|dk(r |jn Jd|tj fd|t j}|j|}|r|j|t||r|j|| |S) NrurxryzUnhandled runtest hook case: cddiS)Nrqr)rqkwds runtest_hooksr5r>z!call_and_report..s /$/$/r7)rUreraiserqrxrnoderxr) rmrrrCallInfo from_callget_reraise_exceptionsrGpytest_runtest_makereportpytest_runtest_logreportcheck_interactive_exceptionpytest_exception_interact)rqrUrrrmrxrrs` ` @r5r{r{s JJE w,1,F,F 00  44 <5dV<z excinfo=)rrUrrs r5__repr__zCallInfo.__repr__rsH << $TYYM4<<:J!L L  Yt||6FaHHr7)rrrrrr2rr2r:r2rUrrboolreturnNone)rrr<)rzCallable[[], TResult]rUrrz & + + QU # ## ># N #  # # JIr7rc.tj||Sr<)rfrom_item_and_callrs r5rrxs  ( (t 44r7cLd fd }tj|dttf}d}|jsd}n/t g}t jjd}||j|jt|jjt|r{d}j|jd}t|tsJt!||j"}|sJt%|j&|j(|j*f}nHd}j-|j} t/| d st| t$sJt1| } | }|js |j2nd} t5j6||| } || _| S) NcHttryjjj j jj djjjjdtjS)N importmodeconsider_namespace_packages)rootpathr) rrrG pluginmanager_loadconftestmodulespathr}rgetinilistcollect collectorsr5rz+pytest_make_collect_report..collect}s i +    * * ? ?  **<8"))22,5,<,<,C,C1- @ I%%'((r7r)rr|unittestrrr toterminal)rzlist[Item | Collector])rrr SystemExitrrrmodulesgetrOSkipTestrrtuple_repr_failure_pyrrepr reprcrashrrlinenor^ repr_failurerNrrrrVrx) rrrxlongreproutcomeskip_exceptionsr r_r errorinforr\s ` r5pytest_make_collect_reportr|sc)&   %6 $C  DBFH <<:B");;??:.    " "8#4#4 5 dll((%*@ AG++DLL&ABb"45 ?tBx ?5 AH1AFF QXXqyy9HG!..t|| 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! ci|_yr<)stackrs r5rzSetupState.__init__s  r7c|j}|jjD],\}\}}||vsJd|s|dj|d|t |jdD]?}||jvsJ|j gdf|j|< |j Ay#t$r3}|j|d||jff|j|<d}~wwxYw)z4Setup objects along the collector chain to the item.z(previous item was not torn down properlyrr N) listchainritemswith_tracebackrTryrurr)rrqneeded_collectorscol finalizersexcs r5ruzSetupState.setups NN,'+jj&6&6&8 4 "C"*c++ W-W W+!f++CF33 4 %S_%67 Cdjj( (( # ~t4DJJsO      #'::c?1#5S=N=N7O"P 3 s"B55 C1>.C,,C1c|rt|trJt|sJ||jvsJ||jf|j|dj |y)zgAttach a finalizer to the given node. The node must be currently active in the stack. rN)rrcallablerrO)r finalizerrs r5 addfinalizerzSetupState.addfinalizers` JtU333 """tzz!5D$**#55! 4""9-r7c |xr|jxsg}g}|jrt|jj|dt |jk(rn|jj \}\}}g}|r|j } ||rt |dk(r|j|n(|r&d|} |jt| |ddd|jrt |dk(r|d|rtd|ddd||jrJyy#t$r} |j| Yd} ~ d} ~ wwxYw)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 zerrors while tearing down rzerrors during test teardown) r rrkeysrTpopitemrrrOextendr!) rrlr# exceptionsrr%_these_exceptionsfinrmsgs r5rgzSetupState.teardown_exactsZ&>(*<*<*>E2*, jjDJJOO%&*;z $/$++A../sD11 E:EEN)rrrqrrr)r)zCallable[[], object]rrrr)rl Item | Nonerr)rrrrrrur*rgrr7r5raras=~ *. "r7rac|j}|j||j|}|jj dd}|r t ||r|j ||||S)Nrrxr)rmpytest_collectstartr__dict__rrr)rrmr\rxs r5collect_one_noder:=sl OOE  299I9NC <<  FD )D +D#6 ''YT#'N Jr7)r3rrr)rWr#rr)rdr"rr)rqrrlr6rr)TN)rqrrrrlr6rzlist[TestReport]r5)rqrrlr6rr)rqrrUz+Literal['setup', 'call', 'teardown'] | Nonerr)rr rztuple[str, str, str] | None)T)rqrrUz$Literal['setup', 'call', 'teardown']rrrr)rGr rztuple[type[BaseException], ...])rxzCallInfo[object]rr rr)rqrrxzCallInfo[None]rr)rrrr)Ir __future__rrcollections.abcr dataclassesrrtypestypingrrrrr r rGr rr rrr_pytestr_pytest._code.coderrr_pytest.config.argparsingr_pytest.deprecatedr _pytest.nodesrrrr_pytest.outcomesrrrrrexceptiongroupr! _pytest.mainr"_pytest.terminalr#r6r_rerhrrror~rrrrrr{rrr dataclassrrrrar:rr7r5rJs9" $  %"1,+,-##!-$)g1$1 * KF'-;? ,78 ) 0) ! !A! !" "IM :AE4  )t , XIwwXIXIv50fK"K"\r7