j7igddlmZddlZddlmZddlmZddlmZddlmZddlm Z ddlm Z ddl Z ddl Z dd l m Z dd lmZdd lmZdd lmZdd lmZddlmZddlmZddlZddlZddlZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!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/m0Z0dd l1m2Z2dd!l3m4Z4er dd"l5m6Z6dd#l7m8Z8d$Z9e ejtjvZ<ed%Z= ded'd()Z?Gd*d+ejZAGd,d(ejeA-ZCd=d.ZDGd/d0eCejZEe d12 d>d3ZFGd4d5eEejZGGd6d7eGejZHGd8d9eGejZIGd:d;eCejZJy)?) annotationsN)Callable)Iterable)Iterator)MutableMapping)cached_property) lru_cache)Path)Any)cast)NoReturn)overload) TYPE_CHECKING)TypeVar) getfslineno) ExceptionInfo) TerminalRepr) Traceback)TracebackStyle) LEGACY_PATH) signature)Config)ConftestImportFailure) _check_path)NODE_CTOR_FSPATH_ARG)Mark) MarkDecorator) NodeKeywords)fail) absolutepath)Stash) PytestWarning)Self)Session/_Tc|5tjtj|jd|| t |||S|Jt |S)N)node_type_name) stacklevel)warningswarnrformat__name__rr ) node_typepathfspaths V/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/nodes.py _imply_pathr3<se  ' '(11       f % !!!F| _NodeTypeNode)boundc,eZdZdZddZdfd ZxZS)NodeMetaaMetaclass used by :class:`Node` to enforce that direct construction raises :class:`Failed`. This behaviour supports the indirection introduced with :meth:`Node.from_parent`, the named constructor to be used instead of direct construction. The design decision to enforce indirection with :class:`NodeMeta` was made as a temporary aid for refactoring the collection tree, which was diagnosed to have :class:`Node` objects whose creational patterns were overly entangled. Once the refactoring is complete, this metaclass can be removed. See https://github.com/pytest-dev/pytest/projects/3 for an overview of the progress on detangling the :class:`Node` classes. ctdj|jd|j}t|dy)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)r- __module__r.r)clskkwmsgs r2__call__zNodeMeta.__call__cs: ! &(#,,8& 9 S% r4c \ t||i|S#t$rtt |d}|j Dcic]\}}||j vs||ncc}}w}}}ddlm}tj||dt|dt|i|cYSwxYw)N__init__)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.) superrD TypeErrorrgetattritems parameters warning_typesrHr+r,set)r@rArBsigvknown_kwrH __class__s r2_createzNodeMeta._createls 47#Q-"- - 4GC45C)+KAqCNN7J1KKHK ? MM(eRSVW_S`Rab(( 7#Q3(3 3 4s"1B+A A A B+*B+)returnr )r@ztype[_T]rUr&)r.r? __qualname____doc__rDrT __classcell__rSs@r2r9r9Ts !44r4r9cjeZdZUdZded<dZ d ddZed dZe d!dZ d"d Z d#d Z e d"d Z d$d Zd%d Zd%dZd&dZd'dZd(d)dZd*d+dZ d* d,dZed-dZed.dZd*d/dZd0dZd1dZd2dZd3dZd4dZ d* d5dZ d* d6dZy)7r6zBase class of :class:`Collector` and :class:`Item`, the components of the test collection tree. ``Collector``\'s are the internal nodes of the tree, and ``Item``\'s are the leaf nodes. rr1)__dict___nodeid_storeconfigr=parentr0sessionNcJ||_||_|r||_n|s td|j|_|r||_n|s td|j|_|| t |dd}t t||||_t||_ g|_ t|_ |d|vsJ||_nB|js td|jjdz|jz|_t!|_|j"|_y)Nz!config or parent must be providedz"session or parent must be providedr0r1z::()z!nodeid or parent must be providedz::)r=r_r^rJr`rKr3typer0rkeywords own_markersrOextra_keyword_matchesr\nodeidr!stashr])selfr=r_r^r`r1r0rgs r2rFz Node.__init__s  "(DK CDD --DK $+DL DEE!>>DL LM M ?MN Ns{{/&/B//r4cL|jj|jS)z6fspath-sensitive hook proxy used to call pytest hooks.)r` gethookproxyr0ris r2ihookz Node.ihooks||((33r4cddj|jjt|ddS)Nz<{} {}>r=)r-rSr.rKros r2__repr__z Node.__repr__s( 7 7vt9TUUr4ct|tstd|t|\}}|Jt j |dt ||dzy)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. z8warning must be an instance of Warning or subclass, got NrG)categoryfilenamelineno) isinstanceWarning ValueErrorget_fslocation_from_itemr+ warn_explicitstr)riwarningr0rvs r2r,z Node.warnsc,'7+J7+V 05 f!!! YA:  r4c|jS)z;A ::-separated string denoting its collection tree address.)r\ros r2rgz Node.nodeids||r4c,t|jSN)hashr\ros r2__hash__z Node.__hash__sDLL!!r4cyrrkros r2setupz Node.setup  r4cyrrkros r2teardownz Node.teardown#rr4c#<K|}|||j}|yyw)zIterate over all parent collectors starting from and including self up to the root of the collection tree. .. versionadded:: 8.1 N)r_)rir_s r2 iter_parentszNode.iter_parents&s) # L]]F scrg}|}| |j||j}| |j|S)zxReturn a list of all parent collectors starting from the root of the collection tree down to and including self.)appendr_reverse)richainitems r2 listchainzNode.listchain1sA  LL ;;D   r4cTddlm}t|tr|}n(t|tr t ||}n t d||j|j<|r&|jj|jy|jjd|jy)zDynamically add a marker object to the node. :param marker: The marker. :param append: Whether to append the marker, or prepend it. r)MARK_GENz'is not a string or pytest.mark.* MarkerN) _pytest.markrrwrr|rKryrdr=rermarkinsert)rimarkerrrmarker_s r2 add_markerzNode.add_marker<s * fm ,G  $h/GFG G&- gll#     # #GLL 1    # #Aw|| 4r4c4d|j|DS)zIterate over all markers of the node. :param name: If given, filter the results by the name attribute. :returns: An iterator of the markers of the node. c3&K|] }|d yw)rGNrk).0xs r2 z$Node.iter_markers..XsE!Esr<)iter_markers_with_noderir=s r2 iter_markerszNode.iter_markersRs Fd99t9DEEr4c#K|jD],}|jD]}|t|dd|k(s||f.yw)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. Nr=)rrerK)rir=noders r2rzNode.iter_markers_with_nodeZsT%%' %D(( %<74#>$#F*$ % %s 5A Acyrrkrs r2get_closest_markerzNode.get_closest_markergsD  ! !$"<"< = >r4c\|jDcgc]}|jc}Scc}wr)rr=)rirs r2 listnameszNode.listnames}s! $ 011111s)cP|jjj||y)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)r` _setupstate addfinalizer)rifins r2rzNode.addfinalizers   --c48r4cN|jD]}t||s|cSy)zGet the closest 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. N)rrw)rir@rs r2 getparentzNode.getparents0%%' D$$  r4c|jSr) traceback)riexcinfos r2_traceback_filterzNode._traceback_filters   r4c ddlm}t|jtr)t j |jj}t|jtjr|jjsd}t|j|r|jjS|jjddrd}d}n|j}|dk(rd}|$|jjddd k(rd }nd}|jjd kDrd}nd }|jjd kDrdnd } t!t#j$|jj&j(k7}|j-d ||jjd d||||S#t*$rd }Y?wxYw)Nr)FixtureLookupErrorvalue fulltraceFlongautotbstyleshortrGT showlocals)funcargsabspathrstyletbfiltertruncate_locals truncate_args)_pytest.fixturesrrwrrrfrom_exceptioncauser Exceptionr> formatreprr^ getoptionr get_verbosityr osgetcwdinvocation_paramsdirOSErrorgetrepr)rirrrrrrrs r2_repr_failure_pyzNode._repr_failure_pys 8 gmm%: ;#227==3F3FGG gmmT^^ 4==(( gmm%7 8==++- - ;; e 4EH--H ={{$$Y77B ;; $ $ & *#O"O!%!:!:!G GGc&|j||S)zReturn a representation of a collection or test failure. .. seealso:: :ref:`non-python tests` :param excinfo: Exception information for the failure. )r)rirrs r2 repr_failurezNode.repr_failures$$We44r4)NNNNNN)r=r|r_ Node | Noner^ Config | Noner`Session | Noner1LEGACY_PATH | Noner0 Path | Nonerg str | NonerUNone)r_r6rUr#)rUzpluggy.HookRelay)rUr|)r}rxrUr)rUintrUr)rUzIterator[Node])rUz list[Node])T)rzstr | MarkDecoratorrboolrUrr)r=rrUzIterator[Mark])r=rrUzIterator[tuple[Node, Mark]])r=r|rU Mark | None)r=r|rrrUr)r=r|rrrUr)rUzset[str])rUz list[str])rzCallable[[], object]rUr)r@ztype[_NodeType]rUz_NodeType | NonerExceptionInfo[BaseException]rUr)rrrTracebackStyle | NonerUr)rrrrrUstr | TerminalRepr)r.r?rVrW__annotations__ __slots__rF classmethodrlpropertyrprrr,rgrrrrrrrrrrrrrrrrrrkr4r2r6r6s  I# $"&%) !;!;!;! ;!  ;! # ;!;!;! ;!z00"44V! J"   # 5,F"& % % $ %?? GG;29 ! (,8 -8 %8   8 z(, 5- 5% 5  5r4) metaclassc|t|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. * "path": just a path :rtype: A tuple of (str|Path, int) with filename and 0-based line number. locationNrobjr0zunknown location)rKr)rrrs r2rzrzsW4;4T3RH| $t $C 3 4!3 4b 88r4cdeZdZdZGddeZejddZ d dZ d dZ y) CollectorzBase class of all collectors. Collector create children through `collect()` and thus iteratively build the collection tree. ceZdZdZy)Collector.CollectErrorz6An error during collection, contains a custom message.Nr.r?rVrWrkr4r2 CollectErrorrsDr4rctd)z;Collect children (items and collectors) for this collector.abstractNotImplementedErrorros r2collectzCollector.collects"*--r4c.t|j|jr@|jj dds$|j}t |j dS|jj dd}|dk(rd}|j||S)zyReturn a representation of a collection failure. :param excinfo: Exception information for the failure. rFrrrr)r)rwrrr^rr|argsr)rirexcrs r2rzCollector.repr_failures gmmT%6%6 7 @U@U A --Csxx{# #++'' 6: f G$$WG$<:ND1|#|%4:tF; <99D!fkkT&9$**6;;7Cs8D||BFFC0 ?% %%nnG > VTYY227>>3J3JKL"&&C-4   )" V89N9NPTU Vs$6E'8E6' E32E36FF)r1r0c *t|d|||d|S)zThe public constructor.)r_r1r0rk)rIrl)r@r_r1r0rBrSs r2rlzFSCollector.from_parentis!w"Q&dQbQQr4)NNNNNNNN)r1rrzPath | Node | Noner0rr=rr_rr^rr`rrgrrUr)r1rr0rrUr#)r.r?rVrWrFrrlrXrYs@r2rr0s/&*-1 " $"&!4 "4 +4  4  4  4 4  4 4  4 l &* R# R  R  R Rr4rceZdZdZy)FilezOBase class for collecting tests from a file. :ref:`non-python tests`. Nrrkr4r2rrvsr4rceZdZdZy) DirectoryaBase class for collecting files from a directory. A basic directory collector does the following: goes over the files and sub-directories in the directory and creates collectors for them by calling the hooks :hook:`pytest_collect_directory` and :hook:`pytest_collect_file`, after checking that they are not ignored using :hook:`pytest_ignore_collect`. The default directory collectors are :class:`~pytest.Dir` and :class:`~pytest.Package`. .. versionadded:: 8.0 :ref:`custom directory collectors`. Nrrkr4r2rr}sr4rceZdZdZdZ d d fd Zd dZejd dZ d dZ d dZ e ddZ xZS)ItemzBase class of all test invocation items. Note that for a single function there might be multiple test invocation items. Nc lt|||f|||d|g|_g|_|j y)N)r^r`rg)rIrF_report_sectionsuser_properties-_check_item_and_collector_diamond_inheritance)rir=r_r^r`rgrBrSs r2rFz Item.__init__sR        =?:< ::.s" "z$ 7RDMM s))zF 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/) rcrKsetattrjoin __bases__r+r,r.r")rir@ attr_nameproblemss r2r$z2Item._check_item_and_collector_diamond_inheritances 4j @ 3 5 ) Y%99 &)mm    MM<<.!%%-J/gg    r4ctd)zRun the test case for this item. Must be implemented by subclasses. .. seealso:: :ref:`non-python tests` z,runtest must be implemented by Item subclassrros r2runtestz Item.runtests""PQQr4cF|r|jj|||fyy)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)riwhenkeycontents r2add_report_sectionzItem.add_report_sections'   ! ! ( ($W)= > r4c |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 rros r2 reportinfozItem.reportinfosyy$""r4c|j}t|d}|jj|}t |dt usJ||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. rrrG)r7r r`_node_location_to_relpathrcr|)rirr0 relfspaths r2rz Item.locations^??$HQK(LL::4@ HQK C'''8A; 44r4)NNNN)r^rr`rrgrrUrr)r2r|r3r|r4r|rUr)rUz.tuple[os.PathLike[str] | str, int | None, str])rUztuple[str, int | None, str])r.r?rVrWnextitemrFr$rrr0r5r7rrrXrYs@r2r r s H  $"&! = =  =  = =:: RR?" # 5 5r4r )r/z type[Node]r0rr1rrUr )rr6rUztuple[str | Path, int | None])rzfrozenset[Path]r0r rUr)K __future__rrcollections.abcrrrr functoolsrr rpathlibr typingr r r rrrr+pluggy _pytest._code_pytestr_pytest._code.coderrrr_pytest.compatrr_pytest.configrr_pytest.config.compatr_pytest.deprecatedr_pytest.mark.structuresrrr_pytest.outcomesr_pytest.pathlibr _pytest.stashr!_pytest.warning_typesr"typing_extensionsr# _pytest.mainr$r__file__r_rr&r3r5ABCMetar9ABCr6rzrrrrrr rkr4r2rSs" $$$*%   %,+(-&$!0-3(10!(/&% w''(// T]   * Kv . )4s{{)4X]5377h]5@ 9&,!cgg,!^ 4 " *.   CR)SWWCRL; SWW$u54u5r4