j7i  dZddlmZddlZddlmZddlmZddlmZddlm Z ddlm Z dd lm Z dd lm Z dd lm Z ddlZddlZddlZdd lmZddlZddlZddlZdd lmZddlZddlZddlZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"Z"ddl#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.ddl/m0Z0ddl/m1Z1ddl/m2Z2ddl/m3Z3dd l/m4Z4dd!l/m5Z5dd"l/m6Z6dd#l/m7Z7dd$l/m8Z8dd%l9m:Z:dd&l9m;Z;dd'lm?Z?dd)l@mAZAdd*l@mBZBdd+l@mCZCdd,l@mDZDdd-lEmFZFdd.lGmHZHdd/lImJZJdd0lImKZKdd1lImLZLdd2lImMZMdd3lImNZNdd4lImOZOdd5lPmQZQdd6lPmRZRdd7lSmTZTdd8lSmUZUdd9lSmVZVdd:lSmWZWdd;lXmYZYddl]m^Z^dd?l]m_Z_e!rdd@l`maZadndAZbdodCZcdpdDZddqdEZee;dFGdrdIZf dsdJZgdtdKZhdudLZidvdNZje;dFG dwdOZkGdPdQe%jZmGdRdSZneojeoeqejdThdUeqeneqenZs[nGdVdWeme%jejZv dxdXZwGdYdMe%jevZyGdZd[e%jZ{dyd\Z|dzd]Z}Gd^d_evZ~d{d`Zd{daZeejdFbGdcddZeejdFbGdedfZd|dgZe\eeeAefZeGdhdBZ d}diZd~djZGdkdHeme%jZGdldmeZy)z7Python test discovery, setup and run of test functions.) annotationsN)Counter) defaultdict)Callable) Generator)Iterable)Iterator)Mapping)Sequence)partial)Path)Any)cast)final)Literal)NoReturn) TYPE_CHECKING)fixtures)nodes)filter_traceback) getfslineno) ExceptionInfo) TerminalRepr) Traceback)saferepr) ascii_escaped)get_default_arg_names) get_real_func) getimfunc)is_async_function) LEGACY_PATH)NOTSET safe_getattr) safe_isclass)Config)hookimpl)Parser)check_ispytest) FixtureDef)FixtureRequest)FuncFixtureInfo)get_scope_node)Session) ParameterSet) _HiddenParam)get_unpacked_marks HIDDEN_PARAM)Mark) MarkDecorator)normalize_mark_listfail)skip fnmatch_ex) import_path)ImportPathMismatchError)scandir) _ScopeName)Scope)StashKey)PytestCollectionWarning)PytestReturnNotNoneWarning)Selfc|jddddgd|jdddgd |jd dd gd |jd ddd|jddddy)N python_filesargsz test_*.pyz *_test.pyz9Glob-style file patterns for Python test module discovery)typedefaulthelppython_classesTestz6Prefixes or glob names for Python test class discoverypython_functionstestzDPrefixes or glob names for Python test function and method discoveryDdisable_test_id_escaping_and_forfeit_all_rights_to_community_supportboolFzcDisable string escape non-ASCII characters, might cause unwanted side effects(use at your own risk)strict_parametrization_idsz:Emit an error if non-unique parameter set IDs are detected)addini)parsers W/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/python.pypytest_addoptionrUUs MM k* H  MM  E   MM  S   MMN -  MM$  I Metafuncc|jjdD],}|j|ji|jd|i.y)N parametrizename _param_mark) definition iter_markersrYrGkwargs)metafuncmarkers rTpytest_generate_testsrbysI%%22 2FPfkkOV]]OOPrVcL|jdd|jddy)Nmarkersaparametrize(argnames, argvalues): call a test function multiple times passing in different arguments in turn. argvalues generally needs to be a list of values if argnames specifies only one name or a list of tuples of values if argnames specifies multiple names. Example: @parametrize('arg1', [1,2]) would lead to two calls of the decorated test function, one with arg1=1 and another with arg1=2.see https://docs.pytest.org/en/stable/how-to/parametrize.html for more info and examples.zusefixtures(fixturename1, fixturename2, ...): mark tests as needing all of the specified fixtures. see https://docs.pytest.org/en/stable/explanation/fixtures.html#usefixtures )addinivalue_line)configs rTpytest_configurerg~s1     SrVc"d}t|dy)Nzasync def functions are not natively supported. You need to install a suitable plugin for your async framework, for example: - anyio - pytest-asyncio - pytest-tornasync - pytest-trio - pytest-twistedFpytracer7)nodeidmsgs rT async_failrms  erVT)trylastFunctionc |j}t|rt|j|j}|j j Dcic]}||| }}|di|}t|ds t|drt|jy|8tjtd|jdt|dycc}w)N __await__ __aiter__z'Test functions should return None, but z returned z. Did you mean to use `assert` instead of `return`? See https://docs.pytest.org/en/stable/how-to/assert.html#return-not-none for more information.T) objr rmrkfuncargs _fixtureinfoargnameshasattrwarningswarnrCrH) pyfuncitem testfunctionruargtestargsresults rTpytest_pyfunc_callrs>>L&:$$%""H.8.E.E.N.NOsXc]"OHO  %H %Fv{#wv{'C:$$%    &9*:K:K9LJW[\bWcVfgqq   Ps Cc|dz } |j}|rtj||Sy#t$rYywxYw)N __init__.pypath)is_filePermissionErrorPackage from_parent)rparentpkginit has_pkginits rTpytest_collect_directoryrsQ]"Goo' ""6"55  s 1 ==c|jdk(rq|jj|s&t||jj dsy|jj |}|j||}|Sy)Nz.pyrF module_pathr)suffixsession isinitpathpath_matches_patternsrfgetini gethookproxypytest_pycollect_makemodule) file_pathrihookmodules rTpytest_collect_filers{5 ~~((3(6==//?++I6::!&;  rVc,tfd|DS)zKReturn whether path matches any of the patterns in the list of globs given.c36K|]}t|ywNr:).0patternrs rT z(path_matches_patterns..sAWz'4(As)any)rpatternss` rTrrs AA AArVModulec0tj||S)Nr)rrrs rTrrs   f;  77rVct|ttzsJt|t |r+|j ||rtj |||Sy|j||rt|d|}tj|s_tjt|sAt|\}}tjtd|ddt!||dzyt|ddrAtj"|rt%d |d d t'|j)||Syy) N)r[rt__func__zcannot collect z because it is not a function.)messagecategoryfilenamelineno__test__Tz:'yield' keyword is allowed in fixtures, but not in tests ()Fri) isinstanceClassrrHr% istestclassristestfunctiongetattrinspect isfunctionrrry warn_explicitrBstrisgeneratorfunctionr8list _genfunctions) collectorr[rtrrs rTpytest_pycollect_makeitemrs8 i 0A$y/A 0C  d +$$YTs$C C2 1  ! !#t ,c:s+""3'7+=+=mC>P+Q*3/ Hf  " "/%dX-KLXz  S*d +**3/PQUPVVWX! //c:; ; rVceZdZdZdZedZedZedZedZ e jdZ dZ d d d Z dd Z y ) PyobjMixinzthis mix-in inherits from Node to carry over the typing information as its intended to always mix in before a node its position in the mro is unaffectedTcL|jt}| |jSdS)z@Python module object this node was collected from (can be None).N) getparentrrtselfnodes rTrzPyobjMixin.modules&~~f%+txx55rVcL|jt}| |jSdS)z?Python class object this node was collected from (can be None).N)rrrtrs rTclszPyobjMixin.cls s&~~e$+txx55rVcy)zPython instance object the function is bound to. Returns None if not a test method, e.g. for a standalone test function, a class or a module. Nrsrs rTinstancezPyobjMixin.instancesrVct|dd}|}|jx|_}|jrZ|jj t |j|jjd|jD|S)zUnderlying Python object._objNc38K|]}|j|fywrrZrmarks rTrz!PyobjMixin.obj..(s$T4dii%6$T) r_getobjr_ALLOW_MARKERS own_markersextendr1rtkeywordsupdaterrts rTrtzPyobjMixin.objswdFD) ;"lln ,DI""  ''(:488(DE $$$T4CSCS$TT rVc||_yr)r)rvalues rTrtzPyobjMixin.obj+s  rVcv|jJ|jj}t||jS)zCGet the underlying Python object. May be overwritten by subclasses.)rrtrr[rs rTrzPyobjMixin._getobj/s2{{&&&kkoosDII&&rVc>g}|jD]h}|j}t|tr9tj j |d}|r|r|j|n|j|j|jdj|S)z5Return Python path relative to the containing module.r.) iter_parentsr[rrosrsplitextappendreversejoin)r stopatmodule includemodulepartsrr[s rT getmodpathzPyobjMixin.getmodpath6s%%' D99D$'ww''-a0$ T* LL    xxrVc\t|j\}}|j}|||fSr)rrtr)rrrmodpaths rT reportinfozPyobjMixin.reportinfoEs-"488, f//#VW$$rVN)TF)rrPrrPreturnr)rz.tuple[os.PathLike[str] | str, int | None, str])__name__ __module__ __qualname____doc__rpropertyrrrrtsetterrrrrsrVrTrrs- N 66 66    ZZ' %rVrc eZdZy) _EmptyClassN)rrrrsrVrTrrPsrVr empty_module>__file__ __cached__ __builtins__cLeZdZd dZd dZd dZd dZd dZd dZddZ ddZ y ) PyCollectorc&|jd|S)NrM_matches_prefix_or_glob_optionrr[s rTfuncnamefilterzPyCollector.funcnamefilteras223EtLLrVc t|ddduS)zgLook for the __test__ attribute, which is applied by the @nose.tools.istest decorator. rFTr#rs rT isnosetestzPyCollector.isnosetestdsCU3t;;rVc&|jd|S)NrKrrs rTclassnamefilterzPyCollector.classnamefilterms223CTJJrVc|j|s|j|rHt|ttzr t |dd}t |xrtj|duSy)NrF) rrr staticmethod classmethodr$callablergetfixturemarkerrrtr[s rTrzPyCollector.istestfunctionpsZ   t $(<#|k9:"3 E:C=KX%>%>s%Ct%K KrVcv|j|s|j|sytj|ryy)NFT)rrr isabstractrs rTrzPyCollector.istestclassys2$$T*dooc.B   c "rVc|jj|D]:}|j|ryd|vs d|vsd|vs#tj||s:yy)z\Check if the given name matches the prefix or glob-pattern defined in configuration.T*?[F)rfr startswithfnmatch)r option_namer[options rTrz*PyCollector._matches_prefix_or_glob_optionsakk((5 Fv&-3&=C6MwfH rVct|jddsgSt|jdig}t|jtr6|jjD]}|j |j t}g}|jjjd}|j}|D]}g}t|jD]\} } | tvr| |vr|j| |sbt|t rRt#j$| st#j&| r(| j(|j+j,k7r|j/|| | } | t| tr|j1| |j | |j |g} t3|D]}| j1|| S)NrT__dict__collect_imported_tests)rr[rt)rrtrrH__mro__rrsetrrfrrritemsIGNORED_ATTRIBUTESaddrrrisclassrrrrrreversed) rdictsbaseclsseen dict_valuesrrdicvaluesr[rtresrs rTcollectzPyCollector.collectstxxT2I:r23 dhh %88++ / W--. / @B !%!4!4!;!;>T\\^-D-DD$55"36;T*MM#&MM#&+ ',   v &5 '<{+ "F MM& ! " rVc #vK|jt}|J|j}|jt}|xr |jxsd}tj |||}|j }t|||j||d} g} t|dr| j|j|,t|dr | j|j|jjj| t| | jst j |||y| j#|j%| jD]K} | j&r|d| j(dn|} t j || | || j(di| Myw) N)r[callobjT)r] fixtureinforfrr _ispytestrb)r`)r[r#r ])r[callspecr#r originalname)rrrtrFunctionDefinitionrrvrWrfrxrrbr call_extradict_callsro _recompute_direct_params_indicesprune_dependency_tree_idlistid) rr[funcobj modulecolrclscolrr]r#r`methodsr&subnames rTrzPyCollector._genfunctionssNN6* $$$&$&**-'33DtW3U  -- !#;;   62 3 NN677 8 ?ws,CD NN3566 7 ((33GT8=TU&&t$K&P P  5 5 7  - - /$OO 6>6F6FTF!HKK=2D** % +&kk40!% + sF7F9N)r[rrrPrtobjectrrP)rtr6r[rrrP)r rr[rrrPrz&Iterable[nodes.Item | nodes.Collector])r[rrzIterator[Function]) rrrrrrrrrr rrsrVrTrr`s-M<K 1f/rVrc|jd} t|||j|jd}|j0j3||S#t$rG}t j jtjjd|d}~wt$r<}t j jdj|j|d}~wt$r}tj}|jdkr$|j j#t$|_|j r|jdn|j'}t)|}t j jd|d ||d}~wt*j,$r2}|j.rt j jd |d}~wwxYw) Nz --import-modeconsider_namespace_packages)moderootr9shortstylezimport file mismatch: imported module {!r} has this __file__ attribute: {} which is not the same as the test file we want to collect: {} HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modulesz)ImportError while importing test module 'zR'. Hint: make sure your test modules/packages have valid Python names. Traceback: zUsing pytest.skip outside of a test will skip the entire module. If that's your intention, pass `allow_module_level=True`. If you want to skip a specific test or an entire class, use the @pytest.mark.skip or @pytest.mark.skipif decorators.) getoptionr<rootpathr SyntaxErrorr Collector CollectErrorr from_currentgetreprr=formatrG ImportError get_verbosity tracebackfilterrexconlyrr9 Exceptionallow_module_level pluginmanagerconsider_module)rrf importmodemodeexc_infoexc_repr formatted_tbs rTimporttestmodulerWs !!/2J- (. 6S(T  Z ((- JQ oo**  & & ( 0 0w 0 ?   # oo** @ 9 :@  I    --/    !A %!)!3!3!:!:;K!LH !!   7  +!!#  8} oo**7v>n     >>   oo** K   s=(A G$!AB## G$/7C&& G$2B*FG$2-GG$c:eZdZdZdZdfd ZddZddZxZS)rz.xunit_setup_module_fixtureIs8^^F',\6B *,_fE+s/2_xunit_setup_module_fixture_rTr[funcrkscopeautouserzGenerator[None]_get_first_non_fixture_funcrtrr]_register_fixturerrk)rrlrerhs @@rTr[z%Module._register_setup_module_fixture8s3 HH5 6 HH;   O$;  F $$66/0A0A/BC+;; 7 rVct|jdt|jdyd fd }|jjj d|jj ||j ddy) a*Register an autouse, function-scoped fixture for the collected module object that invokes setup_function/teardown_function if either or both are available. Using a fixture to invoke this methods ensures we play nicely and unsurprisingly with other fixtures (#517). )setup_function)teardown_functionNc3K|jdy|j} t|d t|yywr)rfunctionrj)rkrzrwrxs rTxunit_setup_function_fixturezMModule._register_setup_function_fixture..xunit_setup_function_fixturehsO+''H),^XF  ,,->I-sAA_xunit_setup_function_fixture_rzTrnrrrs)rr{rwrxs @@rTr\z'Module._register_setup_function_fixtureZs5TXX?RS7 HH,   !&7&?  J $$661$((2C2C1DE-;; 7 rVr7rNone) rrrrrr r[r\ __classcell__ras@rTrr,sF8!  D" rVcLeZdZdZ d dfd ZddZddZxZS) ra|Collector for files and directories in a Python packages -- directories with an `__init__.py` file. .. note:: Directories without an `__init__.py` file are instead collected by :class:`~pytest.Dir` by default. Both are :class:`~pytest.Directory` collectors. .. versionchanged:: 8.0 Now inherits from :class:`~pytest.Directory`. cH|j}t| ||||||y)N)fspathrrrfrrk)rr___init__)rrrrfrrkrras rTrzPackage.__init__s2..   rVct|jdz |j}t|d}| t ||t|d}|#t t||}|j |yy)Nrrcrf)rWrrfrtrjr addfinalizer)rinit_modrerhros rTsetupz Package.setupsy#DII $=t{{K3 5   # (x @5 ;   &7(SD   d # 'rVc#DKdd}|j}|j}t|j|D]}|j rat |j}|j j|ds|j||rY|j||}|o|t|jst |j}|j j|s|j||r|j||}|Ed{y7w)Nc8|jdk7|jfS)NrrZ)entrys rTsort_keyz!Package.collect..sort_keysJJ-/< ris_dirr rrpytest_ignore_collectrrr)rrrfrdirentryrcolcolss rTr zPackage.collects =  84 H HMM*||..t$.G224PV2W 44$t4L?I!!#HMM*||..t4224PV2W 0040M!  sB!D $D :AD DD )NNNN)rzLEGACY_PATH | Nonernodes.Collectorrz Path | Nonerr~r}r7)rrrrrrr rrs@rTrrsK &  "      ,$$ rVrc|jj}tj|r|dz}|r ||y|y)zyCall the given function with the given argument if func accepts one argument, otherwise calls func without arguments.rN)__code__ co_argcountrismethod)ror} arg_counts rTrjrjs9 ))IQ  S  rVcd|D]+}t||d}|tj|)|cSy)zReturn the attribute from the given object to be used as a setup/teardown xunit-style function, but only if not marked as a fixture to avoid calling it twice. N)rrr)rtnamesr[meths rTrtrtsA%c46   9 9$ ? GK rVcVeZdZdZeddd fdZdZd fd Zd dZd dZ xZ S) rzBCollector for test methods (and nested classes) in a Python class.Nrtc (t|d||d|S)The public constructor.)r[rrsr_r)rrr[rtkwras rTrzClass.from_parentsw"BVBrBBrVc"|jSrrrs rT newinstancezClass.newinstancesxxzrVc t|jddsgSt|jrY|jJ|j t d|jj d|jjdgSt|jrY|jJ|j t d|jj d|jjdgS|j|j|jjj|j|jt|AS)NrTzcannot collect test class z. because it has a __init__ constructor (from: rz- because it has a __new__ constructor (from: )r$rthasinitrrzrBrrkhasnew_register_setup_class_fixture_register_setup_method_fixturerr]r^rr_r r`s rTr z Class.collects2DHHj$7I 488 ;;* ** II'01B1B0EF337;;3E3E2FaI  I DHH ;;* ** II'01B1B0EF226++2D2D1EQH  I **, ++- $$33D4D4D4F Tw  rVct|jdt|jdyd fd }|jjj d|jj ||j ddy) a!Register an autouse, class scoped fixture into the collected class object that invokes setup_class/teardown_class if either or both are available. Using a fixture to invoke this methods ensures we play nicely and unsurprisingly with other fixtures (#517). ) setup_class)teardown_classNc3K|j}t}t||dt}t||yywr)rrrj)rkrrorrs rTxunit_setup_class_fixturezFClass._register_setup_class_fixture..xunit_setup_class_fixturesL++C& -,T37 ) 0,T37*sAA_xunit_setup_class_fixture_classTrnrrrtrtrr]rurrk)rrrrs @@rTrz#Class._register_setup_class_fixtures~2$((#9  8 $$66.txx/D/D.EF*;; 7 rVc"dt|jfdt|jfyd fd }|jjj d|jj ||j ddy) a'Register an autouse, function scoped fixture into the collected class object that invokes setup_method/teardown_method if either or both are available. Using a fixture to invoke these methods ensures we play nicely and unsurprisingly with other fixtures (#517). setup_methodteardown_methodNc3K|j}|j}t|}t||dt|}t||yywr)rrzrrj)rkrmethodror setup_namer teardown_names rTxunit_setup_method_fixturezHClass._register_setup_method_fixture..xunit_setup_method_fixture>s]''H%%F'x4,T6: *x7,T6:+sAA_xunit_setup_method_fixture_rzTrnrrr)rrrrrrs @@@@rTrz$Class._register_setup_method_fixture0s$ 2488j]K ) 5dhh@PQ  O$;  ; ; $$66/0E0E/FG+;; 7 rVrrDr7r}) rrrrrrrr rrrrs@rTrrs1L.2CC!: >  rVrcHt|dd}|r|tjk7Sy)NrF)rr6r)rtinits rTrrSs%3 D1D v&& rVcHt|dd}|r|tjk7Sy)N__new__F)rr6r)rtnews rTrrZs%#y$/C fnn$$ rV)frozenceZdZUdZdZded<ded<ded<d ed <d ed <d ed<d ed<ddZddZddZddZ d dZ d!dZ d"dZ d#dZ ed$dZd%dZd&dZy)'IdMakerzMake IDs for a parametrization.)rwrf func_nameidfnidsrk parametersets Sequence[str]rwSequence[ParameterSet]rz%Callable[[Any], object | None] | NonerzSequence[object | None] | Noner Config | Nonerf str | Nonerkrc Zt|j}t|tt|k7rt |}|j rdj |j}dj |jDcgc] }tt|j"c}}dj d|D}dj d|jD}tjd|jd|d|d|d|d j}t j"j%|t't(} t+|D]\} } || d kDs| t,ur|j/d } | r| d j1rd } | | | | } | t|vr&| | xxd z cc<| | | | } | t|vr&| || <| | xxd z cc<t|tt|k(s Jd||Scc}w)ahMake a unique identifier for each ParameterSet, that may be used to identify the parametrization in a node ID. If strict_parametrization_ids is enabled, and duplicates are detected, raises CollectError. Otherwise makes the IDs unique as follows: Format is -...-[counter], where prm_x_token is - user-provided id, if given - else an id derived from the value, applicable for certain types - else The counter suffix is appended only in case a string wouldn't be unique otherwise. z, c34K|]}|tur|ndyw)Nr2)rr/s rTrz7IdMaker.make_unique_parameterset_ids..s! EG"L0Bj@ sc3DK|]\}}|dkDr|tur|ndyw)rrNr2)rr/counts rTrz7IdMaker.make_unique_parameterset_ids..s/'!EqyL0Bj@'s z Duplicate parametrization IDs detected, but strict_parametrization_ids is set. Test name: z% Parameters: z% Parameter sets: z% IDs: z% Duplicates: z You can fix this problem using `@pytest.mark.parametrize(..., ids=...)` or `pytest.param(..., id=...)`. r_zInternal error: resolved_ids=)r _resolve_idslenrr#_strict_parametrization_ids_enabledrrwrrrrtextwrapdedentrkstriprrCrDrint enumerater3(_complain_multiple_hidden_parameter_setsisdigit)r resolved_ids id_counts parametersparamrr duplicatesrl id_suffixesindexr/rnew_ids rTmake_unique_parameterset_idsz$IdMaker.make_unique_parameterset_idssKD--/0 | C $5 6 6 -I779!YYt}}5 $ ?C?Q?QReXd5<<01R! ii KW "YY'%.__%6' oo+%&*[[M2%%/L1%%2O4%%(E*%%/L1 ' UWoo22377+6c*:K&|4 ) rR=1$\)EEGFbfnn.!$ "tF8KO+<=F C $55#B1,$&4x B/@!A!C $55+1L'Oq(O )< CL(9$:: ,|o . :USs %H(c|jy|jjd}||jjd}tt|S)NFrQstrict)rfrrrP)rrQs rTrz+IdMaker._strict_parametrization_ids_enabledsN ;; %)[[%7%78T%U" % -)-););H)E &D455rVc #BKtjD]\}|j>|jtur t.t |jj Qj rgtj krOj @j tur tjj djfdt|jjdDyw)z;Resolve IDs for all ParameterSets (may contain duplicates).N-c3JK|]\}}j||ywr)_idval)rvalargnameidxrs rTrz'IdMaker._resolve_ids..s*$WKKWc2s #Tr) rrr/r3_ascii_escaped_by_configrfrr_idval_from_value_requiredrziprrw)r parametersetrs` @rTrzIdMaker._resolve_idss!*4+=+=!>  C*??l2&&2,HIs8O RZZ ( - - F]  TYY 's8O Z6 <Z0DKrVc|j|}||S|j}|dt|dt|d|d}t |dy)zALike _idval_from_value(), but fails if the type is not supported.Nzids contains unsupported value z (type: z ) at index zf. Supported types are: str, bytes, int, float, complex, bool, enum, regex or anything with a __name__.Fri)r_make_error_prefixrrHr8)rrrr/rrls rTrz"IdMaker._idval_from_value_required"sn  # #C ( >I((*h5hsm_HTRUYMYdehdijs s  S% rVc0t|t|zS)znMake an ID for a parameter in a ParameterSet from the argument name and the index of the ParameterSet.)r)rrs rTrzIdMaker._idval_from_argname0s7|c#h&&rVc<t|jdy)Nzzmultiple instances of HIDDEN_PARAM cannot be used in the same parametrize call, because the tests names need to be unique.)r8r rs rTrz0IdMaker._complain_multiple_hidden_parameter_sets6s# &&()*9 9 rVct|jd|jdS|jd|jdSy)NIn rr)rrkrs rTr zIdMaker._make_error_prefix=s@ >> %(+ + [[ $ R( (rVN)rlist[str | _HiddenParam])rrP)rzIterable[str | _HiddenParam])rr6rrrrrr)rr6rrrrrr)rr6rrrr)rr6rr)rr6rrrr)rrrrrr)rrrr)rrrr __slots____annotations__rrrrrrrrrrrr rsrVrTrras*I)) 0/ ''  AF60 6* ( !''  rVrcDeZdZUdZej eZded<ej eZ ded<ej eZ ded<ej e Z d ed <ej e Zd ed < dd ZddZeddZy) CallSpec2zA planned parameterized invocation of a test function. Calculated during collection for a given test function's Metafunc. Once collection is over, each callspec is turned into a single Item and stored in item.callspec. )default_factoryzdict[str, object]paramszdict[str, int]indiceszMapping[str, Scope] _arg2scoperr.z list[Mark]marksc |jj}|jj} t|j} t ||dD]<\} } | |vr$t jj|d| | || <|| | <|| | <>t|| | |tur |jng|j|g|jt|S)NTrz: duplicate parametrization of )rrrr.r)rcopyrr*rrrrCrDrr3r.rr6) rrwvalsetr/rrp param_indexrkrr arg2scoper}rs rTsetmultizCallSpec2.setmulti]s!!#,,##%) HfT: #HCf}oo22h=cWEF3K&GCL"IcN # $&,$6DLL|} |D]O}| |d k(r | || vr| |}n(tA|j d |tB| ddd }| || |<|g|j|<Qg}|jDxs tGgD]a}tItK||d D]E\}\}}|jM||jN||jP| ||}|jS|Gc||_"y)aW Add new invocations to the underlying test function using the list of argvalues for the given argnames. Parametrization is performed during the collection phase. If you need to setup expensive resources see about setting ``indirect`` to do it at test setup time instead. Can be called multiple times per test function (but only on different argument names), in which case each call parametrizes all previous parametrizations, e.g. :: unparametrized: t parametrize ["x", "y"]: t[x], t[y] parametrize [1, 2]: t[x-1], t[x-2], t[y-1], t[y-2] :param argnames: A comma-separated string denoting one or more argument names, or a list/tuple of argument strings. :param argvalues: The list of argvalues determines how often a test is invoked with different argument values. If only one argname was specified argvalues is a list of values. If N argnames were specified, argvalues must be a list of N-tuples, where each tuple-element specifies a value for its respective argname. :param indirect: A list of arguments' names (subset of argnames) or a boolean. If True the list contains all names from the argnames. Each argvalue corresponding to an argname in this list will be passed as request.param to its respective argname fixture function so that it can perform more expensive setups during the setup phase of a test rather than at collection time. :param ids: Sequence of (or generator for) ids for ``argvalues``, or a callable to return part of the id for each argvalue. With sequences (and generators like ``itertools.count()``) the returned ids should be of type ``string``, ``int``, ``float``, ``bool``, or ``None``. They are mapped to the corresponding index in ``argvalues``. ``None`` means to use the auto-generated id. .. versionadded:: 8.4 :ref:`hidden-param` means to hide the parameter set from the test name. Can only be used at most 1 time, as test names need to be unique. If it is a callable it will be called for each entry in ``argvalues``, and the return value is used as part of the auto-generated id for the whole set (where parts are joined with dashes ("-")). This is useful to provide more specific ids for certain items, e.g. dates. Returning ``None`` will use an auto-generated id. If no ids are provided they will be generated automatically from the argvalues. :param scope: If specified it denotes the scope of the parameters. The scope is used for grouping tests by parameter instances. It will also override any fixture-function defined scope, allowing to set a dynamic scope using test context or configuration. )rkrkzM: 'request' is a reserved name and cannot be used in @pytest.mark.parametrizeFriNzparametrize() call in )descr_param_ids_generatedzUnhandled missing scope: indirectrT)rfbaseidrrorprrr$r)rwrr/rrprrk)*r]rkr/_for_parametrizerzrfr8r@ from_userr_find_parametrized_scoper1_validate_if_using_arg_names_param_ids_fromr5_resolve_parameter_set_idsr6 __setattr___resolve_args_directnessr2rrorr-rrrrrstash setdefaultname2pseudofixturedef_keyr*r*r+rrrr rrr)rrw argvaluesr6rrpr\rkrscope_ generated_idsarg_directnessrname2pseudofixturedefrrIr fixturedefnewcallsr&rparam_id param_set newcallspecs rTrYzMetafunc.parametrizes8Z''"."?"?   MM KK??)) # -   (gh   __5dmm6L6L5MNF.h8M8MxXF ))(H= ;66'77LLM(#-- c=1G1G.  ;66=;P   {::=B)> B BBB)(B)ct|tr"tj||rd}|Sd}|St|trPtj|d}|D]3}||vr(t d|j jd|ddd||<5|St d|j jdt|jdS) aResolve if each parametrized argument must be considered an indirect parameter to a fixture of the same name, or a direct parameter to the parametrized function, based on the ``indirect`` parameter of the parametrized() call. :param argnames: List of argument names passed to ``parametrize()``. :param indirect: Same as the ``indirect`` parameter of ``parametrize()``. :returns A dict mapping each arg name to either "indirect" or "direct". r6directrz: indirect fixture 'z' doesn't existFriz1: expected Sequence or boolean for indirect, got ) rrPr*fromkeysr r8rzrrH)rrwr6rFr}s rTr?z!Metafunc._resolve_args_directnesss$ h %!]]*N$#7?N$( +!]]8X>N 1h&dmm4455I#o^ %'1s#  1 dmm,,-.&&*8n&=&=%>@  rVc 6tt|j}|jj}|D]`}||jvs||vrt d|d|dd+t |tr ||vrdnd}n|rdnd}t d|d|d |d dby ) a4Check if all argnames are being used, by default values, or directly/indirectly. :param List[str] argnames: List of argument names passed to ``parametrize()``. :param indirect: Same as the ``indirect`` parameter of ``parametrize()``. :raises ValueError: If validation fails. rz&: function already takes an argument 'z' with a default valueFrifixtureargumentz: function uses no z ''N)rrrzrr/r8rr )rrwr6default_arg_namesrr}r[s rTr;z%Metafunc._validate_if_using_arg_namess 5dmm DEMM**  C$+++++i[(NseSij % "(H5,/8Oy,4y*i[(;D6C5J % rVc|jjD]7\}}|dk(s t|jD]\}}||j|<9y)NrX)r2rrr+r)rr param_typeir&s rTr,z)Metafunc._recompute_direct_params_indicessY#'#:#:#@#@#B 2 GZX%#,T[[#92KAx01H$$W-2 2rV)NN) r]r(r#zfixtures.FuncFixtureInforfr&r$rPrr~)FNN)rwzstr | Sequence[str]rCz2Iterable[ParameterSet | Sequence[object] | object]r6bool | Sequence[str]r?Iterable[object | None] | Callable[[Any], object | None] | Nonerpz_ScopeName | Noner\z Mark | Nonerr~) rwrrrcrrrkrrr)rzIterable[object | None]rrrrrzlist[object | None])rwrr6rbrz(dict[str, Literal['indirect', 'direct']])rwrr6rbrr~r}) rrrrrrYr=rNr?r;r,rsrVrTrWrWsj  #O #O&#O.#O #O#O #OR*/OS#' |$(|%|F|' | M | ! |!| ||(7(7M(7. (7  (7 " (7T4 $4.4 4  4,%%'% 2 %N'  <2rVc@t|trt|t|k(}n t|}|rT|xsi}|j Dcgc]\}}||vr|dj }}}t |tjStjScc}}w)a}Find the most appropriate scope for a parametrized call based on its arguments. When there's at least one direct argument, always use "function" scope. When a test function is parametrized and all its arguments are indirect (e.g. fixtures), return the most narrow scope based on the fixtures used. Related to issue #1832, based on code posted by @Kingdread. r)rI) rr rrPr_scopeminr@ro)rwarg2fixturedefsr6all_arguments_are_fixtures fixturedefsr[rH used_scopess rTr:r:s(H%%(]c(m%C"%)(^"!%+ %0$5$5$7  jx rN ! !  ;77 >> sBcL|d}n|jd}|r|St|S)NFrO)rr)rrf escape_options rTrr&s1 ~  R  37]3%77rVceZdZdZdZddeddddf dfd Zedfd ZddZ e dZ e dZ d Z d Ze d Zdd Zdd ZddZ ddZxZS)roaItem responsible for setting up and executing a Python test function. :param name: The full function name, including any decorations like those added by parametrization (``my_func[my_param]``). :param parent: The parent Node. :param config: The pytest Config object. :param callspec: If given, this function has been parametrized and the callspec contains meta information about the parametrization. :param callobj: If given, the object which will be called when the Function is invoked, otherwise the callobj will be obtained from ``parent`` using ``originalname``. :param keywords: Keywords bound to the function object for "-k" matching. :param session: The pytest Session object. :param fixtureinfo: Fixture information already resolved at this fixture node.. :param originalname: The attribute name to use for accessing the underlying function object. Defaults to ``name``. Set this if name is different from the original name, for example when it contains decorations like those added by parametrization (``my_func[my_param]``). FNc t ||||||tur||_t |dd|_| xs||_|jjt|j|r,||_ |jj|j|jjd|jD|jj|jj|r|jj||=|j j"} | j%||j|j&}||_|j*|_|j/y)N)rfr__self__c38K|]}|j|fywrrZrs rTrz$Function.__init__..zsL4dii.Lr)r_rr"rr _instancer'rrr1rtr&rrrrrr]getfixtureinforrvr.r/ _initrequest) rr[rrfr&r"rrr#r'fmras rTrzFunction.__init__Ss/ vfgF & DI$Wj$?DN)0D  2488 <= $DM    # #HNN 3 L4;K;KLL TXX../  MM  *  --B++D$((DHHEK-8'55 rVc &t|dd|i|S)rrrsr)rrrras rTrzFunction.from_parentsw"7&7B77rVcJi|_tj|d|_y)NTr,)rur TopRequest_requestrs rTrszFunction._initrequests+-  ++DDA rVc,t|jS)z$Underlying python 'function' object.)rrtrs rTrzzFunction.functions""rVc |jS#t$rEt|jtr|j |_nd|_Y|jSwxYwr)rqAttributeErrorrrr _getinstancers rTrzFunction.instancesP &>> ! &$++u-!%!2!2!4!%~~  &s AAAclt|jtr|jjSyr)rrrrrs rTr|zFunction._getinstances& dkk5 );;**, ,rVc|j}||}n$|jJ|jj}t||jSr)rrrtrr')rr parent_objs rTrzFunction._getobjsF==  !J;;* **Jz4#4#455rVc|S)zA(compatonly) for code expecting pytest-2.2 style request objects.rsrs rT _pyfuncitemzFunction._pyfuncitems  rVc<|jj|y)z%Execute the underlying test function.)r{N)rrrs rTruntestzFunction.runtests %%%6rVc8|jjyr)rx _fillfixturesrs rTrzFunction.setups ##%rVct|dr&|jjdds tjj j t|j}|j|j}}|j}|j||}||k(r0|j|}||k(r|jt}|s|}|j|}|jjdddk(r/t|dkDr!t!|d gd |d d D|d }|S|jS) Nr fulltraceF)r firstlinenortbstyleautor?rc3>K|]}|jdyw)r<N)with_repr_style)rts rTrz-Function._traceback_filter..sSQa//8Ssrr)rxrfr@_pytest_codeCode from_functionrrtrrrJcutrKrrr)rexcinfocoderrrJ ntracebacks rT_traceback_filterzFunction._traceback_filters. 4 )>)>{E)R==%%33M$((4KLD $ 4+;+;+D))I"DkJJY&'^^^6 *!+!2!23C!DJ%%. #**73J{{$$Y76Az?Q&!*&qMS*QrBRS'rN"J    rVcn|jjdd}|dk(rd}|j||S)Nrrlongr=)rfr@_repr_failure_py)rrr>s rT repr_failurezFunction.repr_failures< %%i8 F?E$$WE$::rV)r[rrfrr&zCallSpec2 | NonerzMapping[str, Any] | NonerzSession | Noner#zFuncFixtureInfo | Noner'rrr~rr})rExceptionInfo[BaseException]rr)rrrzstr | TerminalRepr)rrrrrr"rrrrsrrzrr|rrrrrrrrs@rTroro3s:N !%%)-1"&.2#'11 1 # 1+1 1,1!1 1h88B##  67&!<;-; ;rVceZdZdZddZeZy)r(zThis class is a stop gap solution until we evolve to have actual function definition nodes and manage to get rid of ``metafunc``.ctd)Nz8function definitions are not supposed to be run as tests) RuntimeErrorrs rTrzFunctionDefinition.runtestsUVVrVNr})rrrrrrrsrVrTr(r(s?W ErVr()rSr(rr~)r`rWrr~)rfr&rr~)rkrrr~)r{ror object | None)rr rrrznodes.Collector | None)rr rrrz Module | None)rr rr%rrP)rr rr)rzModule | Classr[rrtr6rzHNone | nodes.Item | nodes.Collector | list[nodes.Item | nodes.Collector])rr rfr&r})rtr6rr%rrr5)rkr+rr)rwrrgz3Mapping[str, Sequence[fixtures.FixtureDef[object]]]r6rbrr@)rz str | bytesrfrrr)r __future__rabc collectionsrrcollections.abcrrrr r r r&rr  functoolsr rrTrpathlibr rrtypestypingrrrrrrryrrr _pytest._coderr_pytest._code.coderrr_pytest._io.safereprr_pytest.compatrrrrr r!r"r$r%_pytest.configr&r'_pytest.config.argparsingr(_pytest.deprecatedr)_pytest.fixturesr*r+r,r- _pytest.mainr. _pytest.markr/_pytest.mark.structuresr0r1r3r4r5r6_pytest.outcomesr8r9_pytest.pathlibr;r<r=r> _pytest.scoper?r@ _pytest.stashrA_pytest.warning_typesrBrCtyping_extensionsrDrUrbrgrmrrrrrrNoderr frozensetuniondir ModuleTyperrCABCrrWFiler Directoryrrjrtrrr dataclassrrr*r*rrBrWr:rItemror(rsrVrTrsP=" #$%$$#$     *%,+()(0($,&!''!#,-'+,+ %060(17!!&'3#$"9<&!HP (  $(   '   B 8 $  %( /5 M  FK%K%d__ K().   Q*eooswwQh5 5 5pP UZZP fP eooP f g Kg Td#``$`Fd#;&;&$;&| AHT#z#*>%?@Bt2t2t2n H# @ 8o;z5::o;drV