MCPcopy Create free account
hub / github.com/pytest-dev/pytest / from_current

Method from_current

src/_pytest/_code/code.py:496–515  ·  view source on GitHub ↗

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: Optional[str] = None
    )

Source from the content-addressed store, hash-verified

494
495 @classmethod
496 def from_current(
497 cls, exprinfo: Optional[str] = None
498 ) -> "ExceptionInfo[BaseException]":
499 """Return an ExceptionInfo matching the current traceback.
500
501 .. warning::
502
503 Experimental API
504
505 :param exprinfo:
506 A text string helping to determine if we should strip
507 ``AssertionError`` from the output. Defaults to the exception
508 message/``__str__()``.
509 """
510 tup = sys.exc_info()
511 assert tup[0] is not None, "no current exception"
512 assert tup[1] is not None, "no current exception"
513 assert tup[2] is not None, "no current exception"
514 exc_info = (tup[0], tup[1], tup[2])
515 return ExceptionInfo.from_exc_info(exc_info, exprinfo)
516
517 @classmethod
518 def for_later(cls) -> "ExceptionInfo[E]":

Callers 15

from_callMethod · 0.80
_importtestmoduleMethod · 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