Previously Benji York wrote: > Wichert Akkerman wrote: > >Previously Tres Seaver wrote: > >>I realize I have said this before, but then others keep urging the > >>"doctests everywhere" meme. > > > >Indeed, and for that reason this can't be said enough. Doctests are > >useful to create testable documentation. They are not the right tool to > >create isolated, debuggable tests. > > Not everyone agrees with this assertion. I for one vastly prefer both > to read and write "unity" doctests over classic unit tests. And as > "doctests everywhere" is the current status quo for just about the > entire code base, I would expect a very convincing argument to be > required to change.
The fact that something is popular does not necessarily mean it is the right thing :) Lack of isolation is a very convincing argument to me. Perhaps more personal taste but I also find python unittests to be much more readable. You don't suffer from mixing lots of test setup/teardown being repeated through the file. As Tres mentioned this is especially true when testing corner cases. Being able to debug tests by stepping over them with pdb is incredibly useful. With doctests that doesn't work. Being able to run a single test easily allows for quick testing and debugging. I can't tell the testrunner 'start running at line 52 but also include all the test setup magic from before, but skip the rest'. With unittests I can simple run zopectl test -s <module> -t <test function>. doctests hurt my productivity badly. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope )