MCPcopy Index your code
hub / github.com/pytest-dev/pytest / test_excinfo_getstatement

Function test_excinfo_getstatement

testing/code/test_excinfo.py:77–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76
77def test_excinfo_getstatement():
78 def g():
79 raise ValueError
80
81 def f():
82 g()
83
84 try:
85 f()
86 except ValueError:
87 excinfo = _pytest._code.ExceptionInfo.from_current()
88 linenumbers = [
89 f.__code__.co_firstlineno - 1 + 4,
90 f.__code__.co_firstlineno - 1 + 1,
91 g.__code__.co_firstlineno - 1 + 1,
92 ]
93 values = list(excinfo.traceback)
94 foundlinenumbers = [x.lineno for x in values]
95 assert foundlinenumbers == linenumbers
96 # for x in info:
97 # print "%s:%d %s" %(x.path.relto(root), x.lineno, x.statement)
98 # xxx
99
100
101# testchain for getentries test below

Callers

nothing calls this directly

Calls 2

from_currentMethod · 0.80
fFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…