'L i:*&dZddlmZddlmZddlmZddlZddlZddlZddl Z ddl Z ddl m Z ddl m Z ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlm Z d$dZ!d%dZ"d&dZ#ejHdGddZ%d'dZ&ejHdGddZ'd(dZ(e e'dzZ)e dd)dZ*e d d*d!Z+e d  d+d"Z,d,d#Z-y)-z-Support for skip/xfail functions and markers.) annotations) Generator)MappingN)Config)hookimpl)Parser)Mark)Item)fail)skip)xfail)AbstractRaises) BaseReport) TestReport)CallInfo)StashKeyc|jd}|jddddd|jdd d dd g y) Ngeneralz --runxfail store_truerunxfailFzz"pytest_configure..8s767C#@r'cy)N)argskwargss r%nopzpytest_configure..nop: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.askipif(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-skipifaxfail(condition, ..., *, reason=..., run=True, raises=None, strict=strict_xfail): 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)optionrr,r add_cleanup Exceptionr*addinivalue_line)configr2r+r,s @@r%pytest_configurer92s }}ll@A  %     \  k r'ct|trttt|j d}t |jj|j D]1}t|tstd||j|3t|dr%|j|jj d|jd}t!||d}t#||}n t5|}|j6j9dd} | 9t|tr d|z} | fSd|jddz} t)| d| fS#t$$rT}d|jd d |zd d |j&xsd zzd zdg} t)dj+| dYd}~d}~wt,$r[}d|jd d |zgt/j0t3||} t)dj+| dYd}~d}~wwxYw#t,$rW}d|jdgt/j0t3||} t)dj+| dYd}~xd}~wwxYw)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. )ossysplatformr8)r8z8pytest_markeval_namespace() needs to return a dict, got objevalzError evaluating z conditionz  r^zSyntaxError: invalid syntax F)pytraceNz condition as a booleanreasonz condition: z: zDyou need to specify reason=STRING when using booleans as conditions.) isinstancestrr;r<r=r8reversedihookpytest_markeval_namespacer ValueErrorupdatehasattrr> __globals__namecompiler@ SyntaxErroroffsetr joinr6 tracebackformat_exception_onlyrrr1get) itemmark conditionglobals_ dictionaryfilenamecondition_coderesultexcmsglinesrEmsgs r%evaluate_conditionrbYss)S! kk   # JJ 0 0 0 D  (Jj'2 Nzn] OOJ ' ( 4  OODHH00 1 5499+[1H$Y&AN.(3F& 5)_F[[__Xt ,F ~ i %"Y.F 6> $DII=3XY  e $ 6>O 5#DII= ;" a0036- H 8$e 4 4 5#DII= ;"00cC@H 8$e 4 4  5 5#DII=0GH00cC@H 8$e 4 4  5s?)E. H HA F,, H8AHH I6A I11I6T)frozenc eZdZUdZdZded<y)Skipz$The result of evaluate_skip_marks().zunconditional skiprGrEN)__name__ __module__ __qualname____doc__rE__annotations__r/r'r%reres.&FC&r'rec|jdD]}d|jvr |j}n|jdf}|s)|jjdd}t |cS|D]#}t |||\}}|st |ccS|jdD]#} t |ji|jcSy#t $r}t t|dzdd}~wwxYw) zDEvaluate skip and skipif marks on item, returning Skip if triggered.skipifrOrYrEr z& - maybe you meant pytest.mark.skipif?N) iter_markersr1r0rVrerb TypeErrorrG)rWrX conditionsrErYr^es r%evaluate_skip_marksrss!!x!0$ dkk )J++k24J[[__Xr2F< $ $I/dIFNFFF|# $$"!!v!.Y Y2dkk2 2Y  YCF%MMNTX X Ys,C C5C00C5c>eZdZUdZdZded<ded<ded<ded <y ) Xfailz%The result of evaluate_xfail_marks().)raisesrErunstrictrGrErrwrxz\type[BaseException] | tuple[type[BaseException], ...] | AbstractRaises[BaseException] | NonervN)rfrgrhri __slots__rjr/r'r%rurus#/5I K I L r'rucX|jdD]}|jjdd}|jjd}||jj d}||jj d}|jjdd}d |jvr |j }n|jd f}|s,|jjd d }t ||||cS|D]&}t|||\}}|st ||||ccSy) z;Evaluate xfail marks on item, returning Xfail if triggered.r rmrwTrxNrrvrYrErn)ror1rVr8getinir0rurb) rWrXrwrxrvrqrErYr^s r%evaluate_xfail_marksr|s!!w!/:kkooeT** >[[''7F >[[''1F40 dkk )J++k24J[[__Xr2Fff5 5$ :I/dIFNFFVS&&99 :':0 r')tryfirstc.t|}|r!tj|jdt |x|j t <}|rG|jjjs&|jstd|jzyyyy)NT)_use_item_location [NOTRUN] ) rsr r6rEr|stash xfailed_keyr8r4rrwr )rWskippedxfaileds r%pytest_runtest_setuprss!$'GnnW^^EE(v~6t||'9'9:( &~~  J'  JYY& ~~& 1GNNB  J' &~~ JsGGcPt|dr|jry|jryy)Nr)rxXFAIL)xpassedXXPASS)rMrr)reports r%pytest_report_teststatusr;s#vz" >>* ]]* r')r#rreturnNone)r8rrr)rWr rXr rYobjectrztuple[bool, str])rWr rz Skip | None)rWr rz Xfail | None)rWr rr)rWr rzGenerator[None])rWr rzCallInfo[None]rz'Generator[None, TestReport, TestReport])rrrztuple[str, str, str] | None).ri __future__rcollections.abcrr dataclassesr;r=r<rT_pytest.configrr_pytest.config.argparsingr_pytest.mark.structuresr _pytest.nodesr _pytest.outcomesr r r _pytest.raisesr_pytest.reportsrr_pytest.runnerr _pytest.stashrr&r9rb dataclassrersrur|rrrrrr/r'r%rs/3"%#  !#,(!!")&&#"*$NFRd#''$' 8d#  $  <%hut|$&  4,, $KK" $# #$#,##Lr'