native traceback option

Issue #118 resolved
created an issue

I'm using Eclipse with PyDev and when running unittest this allows me to click on the traceback information to directly jump to the code. For py.test when called from the IDE this does not work, since apparently PyDev relies on the standard traceback format to make it clickable.

Therefore it would be great if a --tb option was added to display tracebacks in the native formatting.

For now I fixed this by inserting the following code in in line 177:
import traceback
tb_strs = traceback.format_tb(excinfo._excinfo[2])
i = 0
while not tb_strs[i].endswith(" testfunction(**funcargs)\n"):
i += 1
tb_strs = tb_strs[i+1:]
return "\n" + "".join(tb_strs) + "\n"

On a side note: I'm currently use {{{py.test.cmdline.main(...)}}} to run py.test from inside the IDE. Maybe one could add some "offical" API to call py.test in this way.


Comments (6)

  1. Holger Krekel repo owner

    thanks ronny. applied to py-trunk, can be installed via e.g.

    pip install
  2. nikow reporter

    Thanks for the quick implementation :-)

    (also good that you use format_exception, using format_tb was a mistake in my code)

  3. Log in to comment