On Mar 13, 2008, at 12:11 AM, Paul Winkler wrote:
On Tue, Mar 11, 2008 at 09:25:59AM -0400, Jim Fulton wrote:
It is certainly straightforward enough to create isolated doctests. For edge cases, I do typically create separate isolated short doctests that deal just with that case. The assertion that doctests don't allow isolation is simply not correct.
Can you think of a package offhand that I might look at to see a good example of this?
zc.buildout is one.
I've got a lot of overgrown, brittle doctests at work that need gradual reorganization, and I'd love to see some good role models.
Hopefully, zc.buildout isn't too bad. Some common doctest traps that I fall into: - Making test files too long -- even for mainline tests. - Writing test files that aren't good documentation. I've been trying out a new practice of creating ".test" files rather than ".txt" files when I don't plan to spend much effort on documentation. I still like to try to tell a story, even if the story is aimed at the implementor. I also don't mind trading off some isolation for flow. I do still prefer to put edge cases into their own tests. Jim -- Jim Fulton Zope Corporation