bg' dZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z ddl mZdd l mZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZdeddfdZ deddfdZ!dedede"de e#e$ffdZ%ej&dGddZ'dede e'fd Z(ej&dGd!d"Z)dede e)fd#Z*ee e)Z+ed$deddfd%Z,ed&dede d'fd(Z-ed&ded)edfd*Z.d+ede e e$e$e$ffd,Z/dS)-z-Support for skip/xfail functions and markers.N)Mapping) Generator)Optional)Tuple)Type)Config)hookimpl)Parser)Mark)Item)fail)skip)xfail) BaseReport)CallInfo)StashKeyparserreturnc|d}|ddddd|dd dd dS) Ngeneralz --runxfail store_truerunxfailFzz"pytest_configure..3s767C#@#@r&cdS)N)argskwargss r$nopzpytest_configure..nop5s Dr&rmarkerszskip(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=xfail_strict): 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)r'r2r+r,s @@r$pytest_configurer8-s } & l@@@@@AAA    %%%     \  k     r&itemmark conditioncDt|trttt|jd}t |j|jD]N}t|ts"td || |Ot|dr| |jj d|jd}t#||d}t%||}n<#t&$rO}d|jzd |zd d |jpd zzd zd g} t+d| dYd}~nd}~wt.$r_}d|jzd |zgt1jt5||} t+d| dYd}~nd}~wwxYw t7|}nh#t.$r[}d|jzgt1jt5||} t+d| dYd}~nd}~wwxYw|jdd} | 9t|trd|z} nd|jzdz} t+| d|| fS)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. )ossysplatformr')r'zevalzError evaluating %r conditionz  r^zSyntaxError: invalid syntax F)pytraceNz*Error evaluating %r condition as a booleanreasonz condition: zError evaluating %r: zDyou need to specify reason=STRING when using booleans as conditions.) isinstancestrr=r>r?r'reversedihookpytest_markeval_namespacer ValueErrorformatupdatehasattrr@ __globals__namecompilerB SyntaxErroroffsetr joinr6 tracebackformat_exception_onlyrrr1get) r9r:r;globals_ dictionaryfilenamecondition_coderesultexcmsglinesrGmsgs r$evaluate_conditionrbTs)S!!05 k    # J 0 0 0 D D  ( (Jj'22  RYY" OOJ ' ' ' ' 4   2 OODH0 1 1 1 5149111H$Y&AAN.(33FF 5 5 5/$);" a0036- H 8$$e 4 4 4 4 4 4 4 4 4 5 5 5/$);"0cC@@H 8$$e 4 4 4 4 4 4 4 4 4  5 5)__FF 5 5 5s?,D G AE  G -AGG G I*AIIT)frozenc"eZdZUdZdZeed<dS)Skipz$The result of evaluate_skip_marks().zunconditional skiprGN)__name__ __module__ __qualname____doc__rGrI__annotations__r/r&r$reres(..&FC&&&&&r&rec|dD]}}d|jvr|j}n|jdf}|s,|jdd}t |cS|D]+}t |||\}}|rt |ccS,~|dD]L} t |ji|jcS#t $r%}t t|dzdd}~wwxYwdS) zDEvaluate skip and skipif marks on item, returning Skip if triggered.skipifrRr;rGrz& - maybe you meant pytest.mark.skipif?N) iter_markersr1r0rYrerb TypeErrorrI)r9r: conditionsrGr;r^es r$evaluate_skip_marksrssV!!x!00$$ dk ) )JJ+k24J [__Xr22F<<   $ $ $I/dIFFNFF $F||##### $ $ !!v!..YY Y2dk22 2 2 2 Y Y YCFF%MMNNTX X Y 4s.C C5 C00C5cheZdZUdZdZeed<eed<eed<ee e e dfed<dS) Xfailz%The result of evaluate_xfail_marks().)rGrunstrictraisesrGrvrw.rxN) rfrgrhri __slots__rIrjrrrr BaseExceptionr/r&r$rurusX//5I KKK III LLL U4 .34 555555r&ruc |dD]}|jdd}|jd|jd}|jdd}d |jvr|j}n|jd f}|s/|jd d }t ||||cS|D].}t|||\}}|rt ||||ccS/dS) z;Evaluate xfail marks on item, returning Xfail if triggered.rrmrvTrwrrxNr;rGrn)ror1rYr'getinir0rurb) r9r:rvrwrxrqrGr;r^s r$evaluate_xfail_marksr}s.!!w!//::kooeT**4;+=+=n+M+MNN400 dk ) )JJ+k24J 6[__Xr22Fff55 5 5 5$ : :I/dIFFNFF :VS&&9999999 : : 4r&)tryfirstct|}|rtj|jdt |x|jt <}|r1|jjj s"|j std|jzdSdSdSdS)NT)_use_item_location [NOTRUN] ) rsrr6rGr}stash xfailed_keyr'r4rrvr)r9skippedxfaileds r$pytest_runtest_setuprs!$''GFnW^EEEE( +** ] +** 4r&)0ri dataclassesr=r?r>rWcollections.abcrtypingrrrr_pytest.configrr _pytest.config.argparsingr _pytest.mark.structuresr _pytest.nodesr _pytest.outcomesr rr_pytest.reportsr_pytest.runnerr _pytest.stashrr%r8objectrrIrb dataclassrersrur}rrrrrr/r&r$rs33  ######!!!!!!######,,,,,,((((((!!!!!!!!!!!!""""""&&&&&&######""""""V&$V$$$$$NHTHH&HU4QT9EUHHHHVd###'''''''$#' dx~8d###6666666$#6t4(hx'))  4,t,,,,, d Gd Gy1A'B G G G G  d.D.....6ZHU3S==Q4Rr&