[py-dev] how to configure additional traceback cut-out

holger krekel holger at merlinux.eu
Sun Jan 17 20:25:18 CET 2010


Hi Ronny, 

On Sun, Jan 17, 2010 at 18:53 +0100, Ronny Pfannschmidt wrote:
> hi,
> 
> while debugging vim-dbus use, 
> i'd like to remove all those nasty line-nosie alike traceback iems  from
> the python dbus libs as they don't really help the traceback.
> 
> Is there any way to do that right now or does it need invention.

No way yet.  The "__tracebackhide__ = True" setting only works for code
you control, obviously.  

However, the internal ExceptionInfo() object has support for processing
tracebacks so i guess we could add a hook that you can use like this:

    # ./conftest.py
    def pytest_filter_traceback(excinfo):
        dbuspath = py.path.local(dbus.__file__).dirpath()
        excinfo.traceback = excinfo.traceback.filter(
            lambda entry: not entry.path.relto(dbuspath))

This hook should not be called when "--tb=full" is specified, i guess.

makes sense to you? 

cheers,
holger



More information about the Pytest-dev mailing list