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

Function test_callinfo

testing/test_runner.py:476–497  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

474
475
476def test_callinfo() -> None:
477 ci = runner.CallInfo.from_call(lambda: 0, "collect")
478 assert ci.when == "collect"
479 assert ci.result == 0
480 assert "result" in repr(ci)
481 assert repr(ci) == "<CallInfo when='collect' result: 0>"
482 assert str(ci) == "<CallInfo when='collect' result: 0>"
483
484 ci2 = runner.CallInfo.from_call(lambda: 0 / 0, "collect")
485 assert ci2.when == "collect"
486 assert not hasattr(ci2, "result")
487 assert repr(ci2) == f"<CallInfo when='collect' excinfo={ci2.excinfo!r}>"
488 assert str(ci2) == repr(ci2)
489 assert ci2.excinfo
490
491 # Newlines are escaped.
492 def raise_assertion():
493 assert 0, "assert_msg"
494
495 ci3 = runner.CallInfo.from_call(raise_assertion, "call")
496 assert repr(ci3) == f"<CallInfo when='call' excinfo={ci3.excinfo!r}>"
497 assert "\n" not in repr(ci3)
498
499
500# design question: do we want general hooks in python files?

Callers

nothing calls this directly

Calls 1

from_callMethod · 0.80

Tested by

no test coverage detected