()
| 75 | |
| 76 | |
| 77 | def 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 | class="cm"># for x in info: |
| 97 | class="cm"># print class="st">"%s:%d %s" %(x.path.relto(root), x.lineno, x.statement) |
| 98 | class="cm"># xxx |
| 99 | |
| 100 | |
| 101 | class="cm"># testchain for getentries test below |
nothing calls this directly
no test coverage detected