On Mon, Mar 10, 2008 at 6:09 PM, Wichert Akkerman <wichert@wiggy.net> wrote:
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.
I completely agree with Tres' and Wichert's statements on this. I only use doctests where they actually would make sense as documentation, the corner cases I always write as unit tests. The tools for dealing with pure Python code are so much more powerful than for python-embedded-in-text-with-prefixes, as well. -- Martijn Pieters