()
| 54 | |
| 55 | |
| 56 | def 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 |
nothing calls this directly
no test coverage detected