j7i|'UdZddlmZddlZddlmZddlmZddlmZddlm Z Gd d e Z e e fZ Gd d e ZGd de ZGdde ZGddeZGddZeZded<GddZeZded<GddZeZded<GddZeZded< d!dd d"d Zy)#zZException classes and constants handling test outcomes as well as functions creating them.) annotationsN)Any)ClassVar)NoReturn)PytestDeprecationWarningc2eZdZdZddfd ZddZeZxZS)OutcomeExceptionzmOutcomeException and its subclass instances indicate and contain info about test and collection outcomes.c|St|tsCd}t|jt |j t |j t ||||_||_ y)NzY{} expected string as 'msg' parameter, got '{}' instead. Perhaps you meant to use a mark?) isinstancestr TypeErrorformattype__name__super__init__msgpytrace)selfrr error_msg __class__s Y/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/_pytest/outcomes.pyrzOutcomeException.__init__sd ?:c3#73 I,,T$Z-@-@$s)BTBTUV V  cf|j |jSd|jjdS)N)rrr)rs r__repr__zOutcomeException.__repr__s/ 88 88O4>>**+:66r)NT)r str | NonerboolreturnNone)r r )r __module__ __qualname____doc__rr__str__ __classcell__rs@rr r s+ 7 Grr cDeZdZdZ ddd dfdZxZS)SkippedbuiltinsF)_use_item_locationcDt|||||_||_y)Nrr)rrallow_module_levelr+)rrrr.r+rs rrzSkipped.__init__-s) S'2"4#5r)NTF) rrrrr.rr+rr r!)rr"r#rr&r's@rr)r)(sYJ#( 5 $) 5  5 5! 5 ! 5  5 5rr)ceZdZdZdZy)Failedz.Raised from an explicit call to pytest.fail().r*Nrr"r#r$rrr0r0<s 8Jrr0c2eZdZdZ d dfd ZxZS)Exitz=Raised for immediate program exits (no tracebacks/summaries).c@||_||_t| |y)N)r returncoderr)rrr6rs rrz Exit.__init__Es $ r)zunknown reasonN)rr r6 int | Noner r!)rr"r#r$rr&r's@rr4r4Bs/GEI7A rr4ceZdZdZy)XFailedz/Raised from an explicit call to pytest.xfail().Nr1r2rrr9r9Ms9rr9c*eZdZUdZeZded<dddZy)_ExitaExit testing process. :param reason: The message to show as the reason for exiting pytest. reason has a default value only because `msg` is deprecated. :param returncode: Return code to be used when exiting pytest. None means the same as ``0`` (no error), same as :func:`sys.exit`. :raises pytest.exit.Exception: The exception that is raised. zClassVar[type[Exit]] ExceptionNc d}t||)NT)rr6)r4)rreasonr6__tracebackhide__s r__call__z_Exit.__call__bs v*55r)N)r>r r6r7r r)rr"r#r$r4r<__annotations__r@r2rrr;r;Qs '+I#*6rr;exitc*eZdZUdZeZded<dddZy)_Skipa0Skip an executing test with the given message. This function should be called only during testing (setup, call or teardown) or during collection by using the ``allow_module_level`` flag. This function can be called in doctests as well. :param reason: The message to show the user as reason for the skip. :param allow_module_level: Allows this function to be called at module level. Raising the skip exception at module level will stop the execution of the module and prevent the collection of all tests in the module, even those defined before the `skip` call. Defaults to False. :raises pytest.skip.Exception: The exception that is raised. .. note:: It is better to use the :ref:`pytest.mark.skipif ref` marker when possible to declare a test to be skipped under certain conditions like mismatching platforms or dependencies. Similarly, use the ``# doctest: +SKIP`` directive (see :py:data:`doctest.SKIP`) to skip a doctest statically. zClassVar[type[Skipped]]r<c d}t||)NT)rr.)r))rr>r.r?s rr@z_Skip.__call__s &5GHHrN)rAF)r>r r.rr r)rr"r#r$r)r<rBr@r2rrrErEjs8*1I&0IrrEskipc*eZdZUdZeZded<dddZy)_FailaaExplicitly fail an executing test with the given message. :param reason: The message to show the user as reason for the failure. :param pytrace: If False, msg represents the full failure information and no python traceback will be reported. :raises pytest.fail.Exception: The exception that is raised. zClassVar[type[Failed]]r<c d}t||)NTr-)r0)rr>rr?s rr@z_Fail.__call__s 11rN)rAT)r>r rrr r)rr"r#r$r0r<rBr@r2rrrIrIs )/I%.2rrIfailc*eZdZUdZeZded<dddZy)_XFailaImperatively xfail an executing test or setup function with the given reason. This function should be called only during testing (setup, call or teardown). No other code is executed after using ``xfail()`` (it is implemented internally by raising an exception). :param reason: The message to show the user as reason for the xfail. .. note:: It is better to use the :ref:`pytest.mark.xfail ref` marker when possible to declare a test to be xfailed under certain conditions like known bugs or missing features. :raises pytest.xfail.Exception: The exception that is raised. zClassVar[type[XFailed]]r<cd}t|)NT)r)r9)rr>r?s rr@z_XFail.__call__s &!!rN)rA)r>r r r)rr"r#r$r9r<rBr@r2rrrMrMs&*1I&0"rrMxfail)exc_typecvddl}d}t|dd| t}d}nd}d}d}|j5|j d t |ddd|r|j|d|r|tj|} || St| dd} |/ddlm} | | | | |krt d|d| d|d | S#|$r\} |d|d | }t |d }|r9t| ts)dd |d d | dddg} tdj| }Yd} ~ d} ~ wwxYw#1swYxYw)aImport and return the requested module ``modname``, or skip the current test if the module cannot be imported. :param modname: The name of the module to import. :param minversion: If given, the imported module's ``__version__`` attribute must be at least this minimal version, otherwise the test is still skipped. :param reason: If given, this reason is shown as the message when the module cannot be imported. :param exc_type: The exception that should be captured in order to skip modules. Must be :py:class:`ImportError` or a subclass. If the module can be imported but raises :class:`ImportError`, pytest will issue a warning to the user, as often users expect the module not to be found (which would raise :class:`ModuleNotFoundError` instead). This warning can be suppressed by passing ``exc_type=ImportError`` explicitly. See :ref:`import-or-skip-import-error` for details. :returns: The imported module. This should be assigned to its canonical name. :raises pytest.skip.Exception: If the module cannot be imported. Example:: docutils = pytest.importorskip("docutils") .. versionadded:: 8.2 The ``exc_type`` parameter. rNTrAevalFignorezcould not import z: )r.zModule 'z3' was found, but when imported by pytest it raised:z z;In pytest 9.1 this warning will become an error by default.zYou can fix the underlying problem, or alternatively overwrite this behavior and silence this warning by passing exc_type=ImportError explicitly.zrSee https://docs.pytest.org/en/stable/deprecations.html#pytest-importorskip-default-behavior-regarding-importerror ) stacklevel __version__)Versionzmodule z has __version__ z, required is: )warningscompile ImportErrorcatch_warnings simplefilter __import__r)r ModuleNotFoundErrorrjoinwarnsysmodulesgetattrpackaging.versionrX)modname minversionr>rPrYr?warn_on_import_errorskippedwarningexclinesmodverattrrXs r importorskiprosZ GR #$"G"G  "E h' E w E4 g! , ++g C c=$/G- ?gg.1DD'$5g[PZ~^#'  JI E~,WKr#?f>G#JsrrPztype[ImportError] | Noner r)r$ __future__rrbtypingrrr warning_typesr BaseExceptionr r< TEST_OUTCOMEr)r0r4r9r;rCrBrErGrIrKrMrOror2rrrus# 3}.!), 55(  9:f:66,ge!I!IHge22*ge""6v "m *. m mm m ' m  mr