On Sun, 2010-01-17 at 20:25 +0100, holger krekel wrote:
> 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? 
> 
that looks very sensible, i'll take a look at where to put that, 
seems like traceback pruning is somewhere in collect

since its about filtering tracebacks,
how about having it take a traceback and return one
so one could do something like:

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


-- Ronny

_______________________________________________
py-dev mailing list
py-dev@codespeak.net
http://codespeak.net/mailman/listinfo/py-dev

Reply via email to