[Zope-dev] Why I dislike narrative doctests

Lennart Regebro regebro at gmail.com
Wed Apr 23 17:33:18 EDT 2008


On Wed, Apr 23, 2008 at 10:19 PM, Marius Gedminas <mgedmin at b4net.lt> wrote:
> Suppose I find a bug (say, zope.testing.testrunner.StartUpFailure
>  objects make unittest.TextTestRunner cry).  Being a good developer I
>  want to start the bug fix with a unit test.
>
...
>  I still maintain that:
>
>   * adding a new unit test should be a trivial task
>
>   * extending a narrative doctest is not a trivial task

Yup. And then, try to debug it when it fails. Oups, you can't pdb through it.

I repeat, and will continue to repeat until everybody gets it: ;-)

Doctests are great. For writing testable documentation. They are NOT
good for writing tests.

>   * the only way to solve this conflict is to explicitly separate unit
>    tests (test_*.py) from doctest-enhanced API documentation (*.txt).

Yup.

-- 
Lennart Regebro: Zope and Plone consulting.
http://www.colliberty.com/
+33 661 58 14 64


More information about the Zope-Dev mailing list