[z3-five] Re: Functional doctests for Five

Philipp von Weitershausen philipp at weitershausen.de
Wed Sep 29 08:14:46 MEST 2004


Martijn Faassen wrote:
> Philipp von Weitershausen wrote:
> > Martijn Faassen wrote:
> 
> >>> Sidnei implemented functional doctests in ZopeTestCase;
> >>> Create a branch to convert Five tests to this.
> >>
> >> All of them?
> > 
> > Why not? :)
> 
> Because I think some of the tests exercise python-level functionality, 
> though I think most don't and make sense as functional tests.

I am converting regular Five unit tests to unit doctests and functional tests 
to functional doctests. I am just converting between two formats of writing 
down tests. I'm not changing the metrics by which we test.

> What is the new ZopeTestCase requirement? Do we need a new version? I 
> only want to depend on released versions of ZopeTestCase if at all 
> possible. I also saw ZopeTestCase is being folded into the Zope core; 
> how does this relate to that?

Since Sidnei and I checked this in yesterday, it is CVS-only for now. That's 
why I'm doing the changes to Five in a branch :)

I would like to see these modifications to ZopeTestCase be released as soon as 
possible. I'm CC'ing Stefan, maybe you can tell us if we can make a new release 
of ZopeTestCase.

I didn't realize that ZTC had been added to Zope trunk
(http://svn.zope.org/Zope/trunk/lib/python/Testing/ZopeTestCase/). I will apply 
Sidnei's changes there.

> >> I'm not yet overwhelmed by the greatness of the functional doctest 
> >> paradigm,
> > 
> > Care to explain?
> 
> I'm not yet convinced functional doctests are the most writeable and 
> readable form of tests. That doesn't mean I'm convinced they're not, but 
> I'll just have to see. I think adding documentation in the tests will be 
> helpful, as we're testing many interesting cases which need more 
> description.

Indeed. I think everyone was skeptical of doctests in the beginning, including 
me. I have grown to love them because a) they're easier and more natural to 
write and b) if written well they make additional developer documentation 
unnessecary.

> >> but we'll see what this branch will look like. :)
> > 
> > Ok. I'll convert a few tests and then you can say whether you like it or 
> > not.
> 
> As importantly, you can also figure out whether you like them for Five 
> or not. :)

I converted the recursion test to a regular doctest and the publish test case 
to a functional doctest. Except for problems with zopeconfigure.py which I 
solved by doing it in a much simpler way, it was an easy change and I like the 
result a lot. Will check this into the branch tonight.

Philipp



More information about the z3-five mailing list