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

Function test_excinfo_getstatement

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

Source from the content-addressed store, hash-verified

54
55
56def test_excinfo_getstatement():
57 def g():
58 raise ValueError
59
60 def f():
61 g()
62
63 try:
64 f()
65 except ValueError:
66 excinfo = _pytest._code.ExceptionInfo.from_current()
67 linenumbers = [
68 f.__code__.co_firstlineno - 1 + 4,
69 f.__code__.co_firstlineno - 1 + 1,
70 g.__code__.co_firstlineno - 1 + 1,
71 ]
72 values = list(excinfo.traceback)
73 foundlinenumbers = [x.lineno for x in values]
74 assert foundlinenumbers == linenumbers
75 # for x in info:
76 # print "%s:%d %s" %(x.path.relto(root), x.lineno, x.statement)
77 # xxx
78
79
80# 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