Fq dZddlZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl"m#Z#ddl"m$Z$ddl"m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)dd l&m*Z*ej+dd!d"krdd#l,m-Z-erdd$l.m/Z/dd%l0m1Z1dd&l2m3Z3d'ed(dfd)Z4dPd,Z5dQd/Z6dQd0Z7d1e$d2e e$d(e8fd3Z9 dRd1e$d5e8d2e e$d(e efd6Z:d1e$d(dfd7Z;d1e$d(dfd8Zd1e$d;e d<d(dfd=Z?d>ed(e e e@e@e@ffd?ZA dSd1e$d;ded(e8fdCZCd1e$d;dz)pytest_terminal_summary..UsQZr<T)keyreverse=zslowest durationszslowest %s durationsr!z>(%s durations < %gs hidden. Use -vv to show these durations.)z02.2fzs z<8 )configoption durations durations_mingetvaluestatsvalueshasattrappendsort write_sep enumerater@ write_linelenwhennodeid) r=rLrMr?trdlistreplistrepis r:pytest_terminal_summaryr_Gs '.8I$+2@M%..y99G B E8??$$"" " "CsJ'' " S!!! "  JJ''J666 " S-.... S09<===jyj!E""KK3 Q;;3<-77 MM"    MMPu::>=12    EE IIIsxIIISZIIJJJJKKr<sessionr&c,t|_dSrB) SetupState _setupstater`s r:pytest_sessionstartregs$,,Gr<c:|jddSrB)rcteardown_exactrds r:pytest_sessionfinishrhks &&t,,,,,r<itemnextitemc|j}||j|jt ||||j|jdS)N)rYlocationrjT)ihookpytest_runtest_logstartrYrlruntestprotocolpytest_runtest_logfinish)rirjrns r:pytest_runtest_protocolrros[ JE !!t}!MMMD8,,,, ""$+ "NNN 4r<Tlogct|d}|r|js|t|d|}|g}|jri|jddrt||jdds$|t|d||t|d|||rd|_d|_ |S) N_requestsetup setupshowF setuponlycallteardownrm) rQru _initrequestcall_and_reportpassedrJ getoptionshow_test_itemrRfuncargs)rirsrj hasrequestr]reportss r:rprpwsz**J$-  $ - -CeG z? ; e 4 4 ! 4 {$$[%88 ? NN?4== > > > NN?4S8LLLMMM  Nr<c|j}||d||jt t |dg}|r;|dd|| dS)zAShow test function, parameters and the fixtures of the test item.z fixturenamesz (fixtures used: {})z, N) rJget_terminal_writerlinewriterYsortedgetattrformatjoinflush)ritw used_fixturess r:rrs  ( ( * *BGGIIIHHWHHT[74<<==MJ '..tyy/G/GHHIIIHHJJJJJr<cdt|d|jj|dS)Nrv)_update_current_test_varr`rcrv)ris r:pytest_runtest_setuprs1T7+++L""4(((((r<cNt|d t`t`t`n#t $rYnwxYw |dS#t$rK}t|t_|t_|j J|j j t_|d}~wwxYw)Nry) rsys last_type last_valuelast_tracebackAttributeErrorruntest Exceptionr1 __traceback__tb_next)ries r:pytest_runtest_callrsT6*** M N            Q ***_4s$( 55A B$ABB$ct|d|jj|t|ddS)Nrz)rr`rcrg)rirjs r:pytest_runtest_teardownrsAT:...L++H555T4(((((r<rXz$Literal['setup', 'call', 'teardown']cd}|r4|jd|d}|dd}|tj|<dStj|dS)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 ()z(null)N)rYreplaceosenvironpop)rirXvar_namevalues r:rrsh%H !;))$))) fh//$ 8 x     r<reportc@|jdvr|jrdS|jrdSdSdS)N)rvrz)errorEERROR)skippedsSKIPPED)rHrHrH)rXfailedrrs r:pytest_report_teststatusrs: {+++ = (( ^ ,,: 4r<c t||fi|}|j}|||}|r||t ||r|||||S)Nriryrnoderyr)call_runtest_hookrnpytest_runtest_makereportpytest_runtest_logreportcheck_interactive_exceptionpytest_exception_interact)rirXrskwdsryhookrs r:r|r|s T4 0 04 0 0D :D77T7MMF 5 %%V%444"400L &&DtF&KKK Mr<ryzCallInfo[object]c|jdSt|drdSt|jjtt jfrdSdS)zVCheck whether the call raised an exception that should be reported as interactive.NFwasxfailT)excinforQ isinstancerrbdbBdbQuit)ryrs r:rrsP |uvz""u$,$w &<==u 4r<zCallInfo[None]c 4|dkr jjn3|dkr jjn |dkr jjn Jd|tf}jdds |tfz }t fd||S) NrvryrzFzUnhandled runtest hook case: usepdbcddiS)Nrir)rnrirsr:rDz#call_runtest_hook..s((4(4((r<)rXreraise) rnrrrrrJr~KeyboardInterruptCallInfo from_call)rirXrrrns` ` @r:rrs w%)Z%D  .    2<s& +--  (,FF   #022G"z'-'I'I"FFF   *,, -/{}}s    s 57A/.A/c\|jd|jd|jdSd|jd|jdS)Nzz excinfo=)rrXrrs r:__repr__zCallInfo.__repr__isD < LTYLL4<LLL LHHHt|HHHHr<rB)__name__ __module__ __qualname____doc__rr__annotations__rrr8boolrpropertyr classmethodr r r rstrrrr<r:rr s:9 g  mM2 3333 LLL KKKOOO ;;;; !- 67     @ & + + + +X +  ( ( %( @(  $}%uT--@#-E'FF G (  ( ( ( [( TI#IIIIIIr<rc,tj||SrB)rfrom_item_and_callrs r:rros  (t 4 44r< collectorc"tfdd}d}|jsd}n4tg}tjd}|||jt|jj t|rvd} |jd}t|tsJt||j}|sJt!|j|j|jf}nTd}|j}t+|ds&t|t sJt-|}|}|js|jnd} t1j||| } || _| S) NcFtSrB)listcollectrsr:rDz,pytest_make_collect_report..tsd9+<+<+>+>&?&?r<rr}unittestrrr toterminal)rrrrrmodulesgetrRSkipTestrrtuple_repr_failure_pyrrepr reprcrashrpathlinenomessage repr_failurerQrrrrYry) rrylongreproutcomeskip_exceptionsrr_r errorinforr]s ` r:pytest_make_collect_reportr ss   ???? K KDEIH <!:B");??:..    " "8#4 5 5 5 dl(%*@*@ A A !G++DL&AABb"455 ? ?tBxx ? ?5 AHH1AF QXqy9HHG!..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! r)Nci|_dSrB)stackrs r:rzSetupState.__init__s  r<ric|}|jD]\}\}}||vs Jd|r||t|jdD]e}||jvsJ|jgdf|j|< |5#t $r$}|j|d|f|j|<|d}~wwxYwdS)z4Setup objects along the collector chain to the item.z(previous item was not torn down properlyNr) listchainritemsrWrzrvr )rrineeded_collectorscol finalizersexcs r:rvzSetupState.setups NN,,'+j&6&6&8&8   "C"*c++++-W+++   %S__%6%67  Cdj(((( # ~t4DJsO     #':c?1#5s"; 3     sB C$CC finalizerrc|rt|trJt|sJ||jvsJ||jf|j|d|dS)zgAttach a finalizer to the given node. The node must be currently active in the stack. rN)rrcallablerrR)rrrs r: addfinalizerzSetupState.addfinalizers{ 3JtU33333 """""tz!!!D$*#5!!! 4""9-----r<rjc |r|pg}g}|jrt|j|dt |jkrn|j\}\}}g}|rN|} |n,#t$r} || Yd} ~ nd} ~ wwxYw|Nt |dkr| |n3|r1d|} |t| |ddd|jt |dkr|d|rtd|ddd| |jrJdSdS)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. Nrzerrors while tearing down rzerrors during test teardown) rrrkeysrWpopitemrr rRextendr$) rrjr exceptionsrr_these_exceptionsfinrmsgs r:rgzSetupState.teardown_exacts%=););)=)=C*, j SDJOO%%&&*;   ! !s B++ C5CC)r)N) rrrrrrrvrobjectrrrrgrr<r:rbrbs==~    $4*.hr6z&:.$.4.... "x~ "$ " " " " " "r<rbc|j}||||}|jdd}|r(t ||r|||||S)Nrryr)rnpytest_collectstartr __dict__rrr)rrnr]rys r:collect_one_noder( s OE  22299I9NNC <  FD ) )D O+D#66O ''YT#'NNN Jr<)r=r'r)N)r`r&r)N)TN)T)Lrr dataclassesrrtypingrrrrrrr r r r r rrrrr_pytestr_pytest._code.coderrr_pytest.compatr_pytest.config.argparsingr_pytest.deprecatedr _pytest.nodesrrr_pytest.outcomesrrrr version_infoexceptiongroupr$typing_extensionsr% _pytest.mainr&_pytest.terminalr'r;r_rerhrrrrprrrrrrrr|rrr dataclassrrr rbr(rr<r:r8s%99   %%%%%%""""""111111,,,,,,++++++ ,,,,,,------######!!!!!!------$$$$$$))))))BQB'!!1111112))))))$$$$$$111111 V*KKKK@''''----$(4.T>B ,4TN *0  $    )t))))) dt()$)(4.)T)))) ! !EF! !!!!" Z HU3S==Q4R    "KO    < CG      &8 * QU     <& ')t , , , ]I]I]I]I]Iww]I]I]I@5D55:5555) >K"K"K"K"K"K"K"K"\ mr<