On Jul 13, 2007, at 5:09 PM, Wichert Akkerman wrote:
Amen. I find failing doctests to be much harder to debug as well.

Are you are of the post-mortem debugging features of the zope.testing test runner? I find this helps a lot when debugging test failures.

On Jul 14, 2007, at 1:00 PM, Wichert Akkerman wrote:
Until you have to step through the test with pdb, at which point it
becomes very painful.

It's true that you can't step across examples. Of course, you can call pdb.set_trace on an example. If you really need to step through multiple examples, you can combine the examples. So, for example, you could convert:

   >>> x = f()
   >>> y = g(x)


   >>> if 1:
   ...          x = f()
   ...          y = g(x)

For me, post-mortem debugging or using set_trace is almost always good enough. On those occasions where I really need to step through a series of example, It's straightforward to convert them to a single example.

In general I find well-written doctests easier to debug because they have documentation and the documentation makes their intent clearer.

Well written doctests will have documentation even when they aren't intended as documentation. Of course, it could be argued that well written classic tests will have comments. I think that doctest facilitates writing good tests, as I have see far more well-written doctests than I've seen well-written classic tests.


Jim Fulton                      mailto:[EMAIL PROTECTED]                Python 
CTO                             (540) 361-1714                  
Zope Corporation        http://www.zope.com             http://www.zope.org

Zope3-dev mailing list
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to