Hi Ronny,

On Sun, Jan 17, 2010 at 22:27 +0100, Ronny Pfannschmidt wrote:
> Hi,
> just played around with traceback cut/filter
> but i don't understand whats happening here:
> 
>         >>> import py
>         >>> py._pydir
>         local('/home/ronny/Projects/py/py')
>         >>> e = py.test.raises(ValueError, "int('a')")
>         >>> tb = e.traceback
>         >>> tb.cut(excludepath=py._pydir)
>         [<TracebackEntry /home/ronny/Projects/py/py/_test/outcome.py:89>, 
> <TracebackEntry /home/ronny/Projects/py/py/_builtin.py:179>, <TracebackEntry 
> <string>:5>, <TracebackEntry <codegen 
> /home/ronny/Projects/py/py/_test/outcome.py:88>:1>]

A slightly special case because other than the pydir only
synthetic code is involved (generated source).  If you have 
at least one "real" entry not relative to pydir it should work. 
Anyway, i changed this in rev1610 - let's see if it causes 
any problems (in py.test reporting).

> i expected it to remove the first few items
> 
> on the other hand
>         >>> tb.filter(lambda x:not
>         py.path.local(x.path).relto(py._pydir))
>         [<TracebackEntry <string>:5>, <TracebackEntry
>         <codegen /home/ronny/Projects/py/py/_test/outcome.py:88>:1>]
>         
> seems to do exactly that and i expected it to filter the last entry, too

The last entry is generated source, what you see if where it got generated.
By passing in a filter function you override the default filter
lambda x: not x.ishidden().  You can "AND" that in your lambda. 

> can we please clarify what each of those really.

hope it is now.

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

Reply via email to