MCPcopy
hub / github.com/pytest-dev/pytest / from_current

Method from_current

src/_pytest/_code/code.py:569–586  ·  src/_pytest/_code/code.py::ExceptionInfo.from_current

Return an ExceptionInfo matching the current traceback. .. warning:: Experimental API :param exprinfo: A text string helping to determine if we should strip ``AssertionError`` from the output. Defaults to the exception message/``__st

(cls, exprinfo: str | None = None)

Source from the content-addressed store, hash-verified

567
568 @classmethod
569 def from_current(cls, exprinfo: str | None = None) -> ExceptionInfo[BaseException]:
570 class="st">"""Return an ExceptionInfo matching the current traceback.
571
572 .. warning::
573
574 Experimental API
575
576 :param exprinfo:
577 A text string helping to determine if we should strip
578 ``AssertionError`` from the output. Defaults to the exception
579 message/``__str__()``.
580 class="st">"""
581 tup = sys.exc_info()
582 assert tup[0] is not None, class="st">"no current exception"
583 assert tup[1] is not None, class="st">"no current exception"
584 assert tup[2] is not None, class="st">"no current exception"
585 exc_info = (tup[0], tup[1], tup[2])
586 return ExceptionInfo.from_exc_info(exc_info, exprinfo)
587
588 @classmethod
589 def for_later(cls) -> ExceptionInfo[E]:

Callers 15

from_callMethod · 0.80
importtestmoduleFunction · 0.80
wrap_sessionFunction · 0.80
_addexcinfoMethod · 0.80
assertrepr_compareFunction · 0.80
parse_warning_filterFunction · 0.80
test_importorskipFunction · 0.80
test_bad_getsourceMethod · 0.80
test_getsourceMethod · 0.80

Calls 1

from_exc_infoMethod · 0.80

Tested by 15

_addexcinfoMethod · 0.64
test_importorskipFunction · 0.64
test_bad_getsourceMethod · 0.64
test_getsourceMethod · 0.64
test_tb_entry_strMethod · 0.64
test_ExceptionChainReprFunction · 0.64
test_excinfo_simpleFunction · 0.64
setup_methodMethod · 0.64