bggddlZddlZddlmZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlZddlmZddlmZddlmZddlmZddlmZddlmZddl m!Z!ddl m"Z"ddl#m$Z$ddl#m%Z%ddl&m'Z'ddl&m(Z(ddl&m)Z)dd l*m+Z+dd!l,m-Z-dd"l,m.Z.dd#l/m0Z0dd$l1m2Z2er dd%l3m4Z4dd&lm5Z5d'Z6eej7j8Z9d(e:d)e e:fd*Z;d+ed,ed)dfd-ZGd3d4e?Z@Gd5d/e@6ZAd7d/d)eee:efeeBffd8ZCGd9d:eAZDd;dd?eDZFGd@dAeFZGGdBdCeAZHdS)DN) signature)Path)Any)Callable)cast)Iterable)Iterator)List)MutableMapping)Optional)overload)Set)Tuple)Type) TYPE_CHECKING)TypeVar)Union) getfslineno) ExceptionInfo) TerminalRepr) Traceback)cached_property) LEGACY_PATH)Config)ConftestImportFailure)#FSCOLLECTOR_GETHOOKPROXY_ISINITPATH)NODE_CTOR_FSPATH_ARG)Mark) MarkDecorator) NodeKeywords)fail) absolutepath) commonpath)Stash) PytestWarning)Session)_TracebackStyle/nodeidreturnc#Kd}|d}|dkrd}dV |t||}|dkrn*|dkr |d|V|ttz}M |d|}|dkrn%|dkr |d|V|tdz}B|r|VdSdS)aReturn the parent node IDs of a given node ID, inclusive. For the node ID "testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source" the result would be "" "testing" "testing/code" "testing/code/test_excinfo.py" "testing/code/test_excinfo.py::TestFormattedExcinfo" "testing/code/test_excinfo.py::TestFormattedExcinfo::test_repr_source" Note that / components are only considered until the first ::. r::N)findSEPlen)r)pos first_colonsats ^/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/_pytest/nodes.pyiterparentnodeidsr64s$ C"(++d"3"3Lr HHH [[c< 0 0 88  66"+   3s88m  [[s # # 88  66"+   3t99n  pathfspathcXt||krtd|d|ddS)NzPath(z) != z8 if both path and fspath are given they need to be equal)r ValueError)r8r9s r5 _check_pathr<asU F||t FF F F4 F F F   r7 node_typeNodec|.tjtj|jd||t |||S|Jt |S)N)node_type_name stacklevel)warningswarnrformat__name__r<r)r=r8r9s r5 _imply_pathrHis~  '(1            f % % % !!!F||r7 _NodeType)boundc$eZdZdZfdZxZS)NodeMetacrd|jd|j}t|ddS)NzDirect construction of {name} has been deprecated, please use {name}.from_parent. See https://docs.pytest.org/en/stable/deprecations.html#node-construction-changed-to-node-from-parent for more details..nameF)pytrace)rF __module__rGr!)selfkkwmsgs r5__call__zNodeMeta.__call__sJ ! &::4=::& ; ; S%      r7c r tj|i|S#t$rtt |dfd|D}ddlm}tj ||dt|dtj|i|cYSwxYw)N__init__c.i|]\}}|jv||S) parameters).0rTvsigs r5 z$NodeMeta._create..s+KKKAqCN7J7J17J7J7Jr7)PytestDeprecationWarningz7 is not using a cooperative constructor and only takes z. See https://docs.pytest.org/en/stable/deprecations.html#constructors-of-custom-pytest-node-subclasses-should-take-kwargs for more details.) superrW TypeErrorrgetattritems warning_typesrbrDrEset)rSrTrUknown_kwrbr_ __class__s @r5_createzNodeMeta._creates 4#577#Q-"-- - 4 4 4GD*5566CKKKKKKKH ? ? ? ? ? ? M((((TWX`TaTa(((   $577#Q3(33 3 3 3 4sBB65B6)rGrR __qualname__rWrk __classcell__rjs@r5rLrLsG!!!444444444r7rLceZdZUdZeed<dZ d/dedddee d d deed ee d eed dfdZ e d0dZ edZd efdZded dfdZed efdZd efdZd1dZd1dZd edfdZ d2deeefded dfdZd3deed eefdZ d3deed ee!deffdZ"e#ded eefdZ$e#ded ed efd!Z$ d3ded eed eefd"Z$d e%efd#Z&d eefd$Z'd%e(ge)fd dfd&Z*d'e+e,d ee,fd(Z-d)e.e/d e0fd*Z1 d3d)e.e/d+d,d e2fd-Z3 d3d)e.e/d+d,d eee2ffd.Z4dS)4r>zBase class for Collector and Item, the components of the test collection tree. Collector subclasses have children; Items are leaf nodes. r9)rPparentconfigsessionr8_nodeid_store__dict__NrPrpzOptional[Node]rqrrzOptional[Session]r8r)r*cN||_||_|r||_n|std|j|_|r||_n|std|j|_||t |dd}t t||||_t||_ g|_ t|_ |d|vsJ||_n2|jstd|jjdz|jz|_t!|_|j|_dS)Nz!config or parent must be providedz"session or parent must be providedr8r9z::()z!nodeid or parent must be providedr,)rPrprqrdrrrerHtyper8r keywords own_markersrhextra_keyword_matchesrsr)r$stashrt)rSrPrprqrrr9r8r)s r5rYz Node.__init__sC   ("(DKK E CDDD -DK  *$+DLL F DEEE!>DL >LMM M ??MNN Ns{//&/B///r7c@|j|jS)z6fspath-sensitive hook proxy used to call pytest hooks.)rr gethookproxyr8rSs r5ihookz Node.ihook s|((333r7c`d|jjt|ddS)Nz<{} {}>rP)rFrjrGrers r5__repr__z Node.__repr__s) 7vt9T9TUUUr7warningct|ts"td|t |\}}|Jt j|dt||dzdS)awIssue a warning for this Node. Warnings will be displayed after the test session, unless explicitly suppressed. :param Warning warning: The warning instance to issue. :raises ValueError: If ``warning`` instance is not a subclass of Warning. Example usage: .. code-block:: python node.warn(PytestWarning("some message")) node.warn(UserWarning("some message")) .. versionchanged:: 6.2 Any subclass of :class:`Warning` is now accepted, rather than only :class:`PytestWarning ` subclasses. zz$Node.iter_markers..rs&EE!EEEEEEr7rO)iter_markers_with_noderSrPs r5 iter_markerszNode.iter_markersls* FEd99t9DDEEEEr7c#Kt|D])}|jD]}|t|dd|kr||fV *dS)zIterate over all markers of the node. :param name: If given, filter the results by the name attribute. :returns: An iterator of (node, mark) tuples. NrP)reversedrrzre)rSrPnoders r5rzNode.iter_markers_with_nodetsvT^^--.. % %D( % %<74#>#>$#F#F*$$$ % % %r7cdSrr[rs r5get_closest_markerzNode.get_closest_marker r7defaultcdSrr[rSrPrs r5rzNode.get_closest_markerrr7cJt|||S)zReturn the first marker matching the name, from closest (for example function) to farther level (for example module level). :param default: Fallback return value if no marker was found. :param name: Name to filter by. rO)nextrrs r5rzNode.get_closest_markers%D%%4%00':::r7ct}|D]}||j|S)z;Return a set of all extra keywords in self and any parents.)rhrupdater{)rSextra_keywordsrs r5listextrakeywordszNode.listextrakeywordssD#&55NN$$ > >D  ! !$"< = = = =r7c>d|DS)Ncg|] }|j Sr[rOrs r5 z"Node.listnames..s1111111r7)rrs r5 listnameszNode.listnamess 11 0 01111r7fincF|jj||dS)zRegister a function to be called without arguments when this node is finalized. This method can only be called when this node is active in a setup chain, for example during self.setup(). N)rr _setupstate addfinalizer)rSrs r5rzNode.addfinalizers%  --c488888r7r~c|}|r)t||s|j}|rt|||t||sJ|S)zGet the next parent node (including self) which is an instance of the given class. :param cls: The node class to search for. :returns: The node, if found. )rrp)rSr~currents r5 getparentzNode.getparentsa#' %j#66 %nG %j#66 %*Wc":"::r7excinfoc|jSr) traceback)rSrs r5_traceback_filterzNode._traceback_filters   r7stylezOptional[_TracebackStyle]cddlm}t|jtrt j|jj}t|jtj r|jj sd}t|j|r|j S|j ddrd}d}n|j}|dkrd}|$|j ddd krd }nd}|j d dd krd}nd } tt!j|j jjk}n#t($rd }YnwxYw|d ||j d d|||S)Nr)FixtureLookupErrorvalue fulltraceFlongautotbstyleshortverboseraT showlocals)funcargsabspathrrtbfiltertruncate_locals)_pytest.fixturesrrrrr from_exc_inforr! ExceptionrQ formatreprrq getoptionrrosgetcwdinvocation_paramsdirOSErrorgetrepr)rSrrrrrrs r5_repr_failure_pyzNode._repr_failure_pys 877777 gm%: ; ; I#1'-2GHHG gmT^ 4 4 =(  gm%7 8 8 .=++-- - ; e 4 4 EHH-H ={$$Y777BB ; A . . 2 2#OO"O 29;;''4;+H+LLGG   GGG {,,\5AA+    s3E EEc.|||S)zReturn a representation of a collection or test failure. .. seealso:: :ref:`non-python tests` :param excinfo: Exception information for the failure. )r)rSrrs r5 repr_failurezNode.repr_failures$$We444r7)NNNNNN)rpr>r*N)Tr)5rGrRrl__doc__r__annotations__ __slots__rr rrrY classmethodrpropertyrrrrEr)intrrrr rrrboolrr rrrrr rrrrrobjectrrrIrr BaseExceptionrrrrrr[r7r5r>r>sk  I$(#''+(,# $;!;!;!!;! ;! % ;! % ;!tn;! ;! ;!;!;!;!z000[0"44X4V#VVVV# G# # # # # NX"#""""         4<    AE55C./59=5 55550FF#F(4.FFFF%) % %SM % % % & % % % % s x~   X  s T d   X 48 ; ; ;"*4. ; $ ; ; ; ;3s824922229V 499999 T)_ )1D    !})E!)!!!! .25 5 }-5 +5   5 5 5 5 t.2 5 5}- 5+ 5 sL ! 5 5 5 5 5 5r7) metaclassrct|dd}| |ddSt|dd}|t|St|dddfS)aTry to extract the actual location from a node, depending on available attributes: * "location": a pair (path, lineno) * "obj": a Python object that the node wraps. * "fspath": just a path :rtype: A tuple of (str|Path, int) with filename and 0-based line number. locationNobjr9zunknown locationr-)rer)rrrs r5rrsg:AzSW9X9XH| $t $ $C 3 4#5 6 6 ::r7ceZdZdZGddeZdeedfdZde e dee e ffdZ de e defd Zd S) Collectorz\Collector instances create children through collect() and thus iteratively build a tree.ceZdZdZdS)Collector.CollectErrorz6An error during collection, contains a custom message.NrGrRrlrr[r7r5 CollectErrorrsDDDDr7rr*)Itemrc td)zRReturn a list of children (items and collectors) for this collection node.abstractNotImplementedErrorrs r5collectzCollector.collects"*---r7rc"t|j|jr<|jdds!|j}t |jdS|jdd}|dkrd}|||S)zyReturn a representation of a collection failure. :param excinfo: Exception information for the failure. rFrrrr)r)rrrrqrrargsr)rSrexcrs r5rzCollector.repr_failures gmT%6 7 7 $ @U@U A A  $-Csx{## #+'' 6:: f  G$$WG$<<rrrrHrxrPr8rrr;replacersepr0rrrqrootpathrrcrY) rSr9rr8rPrprqrrr)rrjs r5rYzFSCollector.__init__Ds  &.$// &~~~k>::ND11 &|||%4::tF;;; <9D!fkT&9&9$**6;77Cs88DD"D||BFC00 ?%%%nG > HTY227>3JKKLL H H H8$GG H 5"&C--44       s$B.. B;:B;:1D,,E E )r9r8c >tjd|||d|S)zThe public constructor.)rpr9r8r[)rcr)r~rpr9r8rUrjs r5rzFSCollector.from_parentzs+#uww"Q&dQQbQQQr7os.PathLike[str]cltjtd|j|SNrrB)rDrErrrr)rSr9s r5rzFSCollector.gethookproxys. 9aHHHH|((000r7cltjtd|j|Sr!)rDrErrr isinitpath)rSr8s r5r#zFSCollector.isinitpaths. 9aHHHH|&&t,,,r7)NNNNNNNN)r9r)rGrRrlr rrrr>rrrYrrrrr#rmrns@r5rrCs)-6:#"!%#''+ $4 4 %4 !tTz!234 tn 4 sm 4  4  4 )$4  4  4 4 4 4 4 4 l )-# R R R% R tn R R R R R[ R1111-uS*<%<=-$--------r7rceZdZdZdS)FilezOBase class for collecting tests from a file. :ref:`non-python tests`. Nrr[r7r5r%r%sr7r%c eZdZdZdZ ddeededdeeddffd Zdd Z dd Z d ed ed eddfdZ de e defeeeffdZede eeeeffdZxZS)rzvA basic test invocation item. Note that for a single function there might be multiple test invocation items. Nrqrrr&r)r*c tj||f|||d|g|_g|_|dS)N)rqrrr))rcrY_report_sectionsuser_properties-_check_item_and_collector_diamond_inheritance)rSrPrprqrrr)rUrjs r5rYz Item.__init__sq           =?:< ::<<<<.sG  "z$ 7R7R M      r7zF is an Item subclass and should not be a collector, however its bases z are collectors. Please split the Collectors and the Item into separate node types. Pytest Doc example: https://docs.pytest.org/en/latest/example/nonpython.html example pull request on a plugin: https://github.com/asmeurer/pytest-flakes/pull/40/) rxresetattrjoin __bases__rDrErGr%)rSr~ attr_nameproblemss r5r*z2Item._check_item_and_collector_diamond_inheritances 4jj @ 3 5 ) )  FY%%%99  &)m        M<gg%-ggg         r7c td)zRun the test case for this item. Must be implemented by subclasses. .. seealso:: :ref:`non-python tests` z,runtest must be implemented by Item subclassrrs r5runtestz Item.runtests""PQQQr7whenkeycontentcH|r|j|||fdSdS)aAdd a new report section, similar to what's done internally to add stdout and stderr captured output:: item.add_report_section("call", "stdout", "report section contents") :param str when: One of the possible capture states, ``"setup"``, ``"call"``, ``"teardown"``. :param str key: Name of the section, can be customized at will. Pytest uses ``"stdout"`` and ``"stderr"`` internally. :param str content: The full contents as a string. N)r(r)rSr7r8r9s r5add_report_sectionzItem.add_report_sections:  ?  ! ( ($W)= > > > > > ? ?r7rc|jddfS)aPGet location information for this item for test reports. Returns a tuple with three elements: - The path of the test (default ``self.path``) - The 0-based line number of the test (default ``None``) - A name of the test to be shown (default ``""``) .. seealso:: :ref:`non-python tests` Nr.r rs r5 reportinfozItem.reportinfosy$""r7c |}ttj|d}|j|}t |dtusJ||d|dfS)z Returns a tuple of ``(relfspath, lineno, testname)`` for this item where ``relfspath`` is file path relative to ``config.rootpath`` and lineno is a 0-based line number. rrra)r=r"rr9rr_node_location_to_relpathrxr)rSrr8 relfspaths r5rz Item.locationsu??$$BIhqk2233L::4@@ HQK  C''''8A; 44r7)NNNNr)rGrRrlrnextitemr rrrYr*r6r;rrrr=rrrmrns@r5rrsa H #''+ $ == = )$ =  = ======::RRRR?s??s?t????" #E%(:C(?"@(3-QT"TU # # # # 5%Xc]C 78 5 5 5_ 5 5 5 5 5r7r)IrrDinspectrpathlibrtypingrrrrr r r r r rrrrrr _pytest._code_pytestr_pytest._code.coderrr_pytest.compatrr_pytest.configrr_pytest.deprecatedrr_pytest.mark.structuresrrr _pytest.outcomesr!_pytest.pathlibr"r# _pytest.stashr$_pytest.warning_typesr% _pytest.mainr&r'r0__file__rprrr6r<rHrIrxrLr>rrrrrr%rr[r7r5rRs !!!!!! %%%%%%,,,,,,++++++((((((******&&&&&&!!!!!!000000BBBBBB333333((((((111111000000!!!!!!((((((&&&&&&//////3$$$$$$222222 $w'((/*c*hsm****Z d K D    F| 4. [ ! * GKv . . . 44444t444