[TIP] pytest-2.0: asserts++, unittest++, reporting++, config++, docs++

holger krekel holger at merlinux.eu
Sat Nov 27 05:58:07 PST 2010


On Fri, Nov 26, 2010 at 18:02 -0800, Phlip wrote:
> On Fri, Nov 26, 2010 at 3:31 PM, holger krekel <holger at merlinux.eu> wrote:
> 
> > It comes from Python frame objects. And yes, you can use "py.test -l" to show
> > local variables. Or "--pdb" to start an interactive debugger.  If there were a
> > web interface you could probably click on it and see variable names and values
> > :)
> 
> Then why can't the diagnostic reflector use them? I thought you
> implied the reflector had to re-evaluate them. (That's how both
> assert{ 2.0 } and Wrong do it, in Ruby, with less reflection support.)

If you have:

    assert func() == 42

then 'func' will be looked up from the locals and it will
be called to obtain and present its result.  And i probably
wasn't clear: unless the assertion fails, _no_ py.test 
specific code is executed, whatsoever. 

best,
holger



More information about the testing-in-python mailing list