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

Function test_callinfo

testing/test_runner.py:572–593  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

570
571
572def test_callinfo() -> None:
573 ci = runner.CallInfo.from_call(lambda: 0, "collect")
574 assert ci.when == "collect"
575 assert ci.result == 0
576 assert "result" in repr(ci)
577 assert repr(ci) == "<CallInfo when='collect' result: 0>"
578 assert str(ci) == "<CallInfo when='collect' result: 0>"
579
580 ci2 = runner.CallInfo.from_call(lambda: 0 / 0, "collect")
581 assert ci2.when == "collect"
582 assert not hasattr(ci2, "result")
583 assert repr(ci2) == f"<CallInfo when='collect' excinfo={ci2.excinfo!r}>"
584 assert str(ci2) == repr(ci2)
585 assert ci2.excinfo
586
587 # Newlines are escaped.
588 def raise_assertion():
589 assert 0, "assert_msg"
590
591 ci3 = runner.CallInfo.from_call(raise_assertion, "call")
592 assert repr(ci3) == f"<CallInfo when='call' excinfo={ci3.excinfo!r}>"
593 assert "\n" not in repr(ci3)
594
595
596# 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…