Closed
Description
Given t/test_pdb_offset.py
:
def raises():
raise Exception('outer')
def test_pdb_offset():
__import__('pdb').set_trace()
print(1)
raises()
Running pytest t/test_pdb_offset.py --tb=short --pdb
result in:
==================================== test session starts ====================================
platform linux -- Python 3.6.4, pytest-3.4.1.dev51+gb486e129, py-1.5.2, pluggy-0.6.0
rootdir: …/Vcs/pytest, inifile: tox.ini
collected 1 item
t/test_pdb_offset.py
>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>
> …/Vcs/pytest/t/test_pdb_offset.py(7)test_pdb_offset()
-> print(1)
(Pdb) c
1
F
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
t/test_pdb_offset.py:7: in test_pdb_offset
print(1)
t/test_pdb_offset.py:2: in raises
raise Exception('outer')
E Exception: outer
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> …/Vcs/pytest/t/test_pdb_offset.py(2)raises()
-> raise Exception('outer')
(Pdb) c
[100%]
================================== short test summary info ==================================
FAIL t/test_pdb_offset.py::test_pdb_offset
Notice the first entry in the traceback (t/test_pdb_offset.py:7
), which refers to the line after the pdb.set_trace()
, but it should be the line where raises
gets called.
pytest 3.4.1.dev51+gb486e129.