On Mon, Apr 19, 2010 at 9:48 AM, Marius Gedminas <[email protected]> wrote: > On Mon, Apr 19, 2010 at 12:50:23PM +0200, Adam GROSZER wrote: >> >> I'm somewhat vary on unittests. I've seen some damn cryptic ones that >> took a lot of time to decipher. >> A doctest somehow forces you to dump your mind (well at least that, if >> we're not that brilliant techdoc writers). > > That's true, but if the doctest gets too long, any readability > advantages are negated. > > If you've the discipline to keep the doctests short, I don't see why you > shouldn't continue writing them instead of unit tests -- and by "short" > I mean 1-7 statements:
You might be interested in Manuel's isolation mechanism: http://packages.python.org/manuel/#test-isolation > The downside of this style is that it's difficult to refactor common > bits from the doctests into shared methods, so you end up with a lot of > duplicated code. If I understand you (which I'm not sure I do), I prefer to factor out common code into test helpers that are either referenced in footnotes (to keep all the code in one place) or in a separate module. -- Benji York _______________________________________________ Zope-Dev maillist - [email protected] https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )
