[Biopython-dev] docstring tests
Peter
biopython at maubp.freeserve.co.uk
Wed Feb 11 13:16:06 UTC 2009
On Wed, Feb 11, 2009 at 11:14 AM, Giovanni Marco Dall'Olio
<dalloliogm at gmail.com> wrote:
> On the long run, it will be hard without fixtures: imagine, for
> example, the docs in BioSQL, where you will have to put the
> instructions to create a new database in every method's docstring of
> every class.
BioSQL is a special case - we can't have doctests which will work on
every machine unless the user has installed particular database (e.g.
MySQL), using particular database names, usernames and passwords. So
I don't think we need to worry about doctests for BioSQL - because of
its nature.
For other complicated modules, you could just put one complex
multi-part example in the main docstring, and not have individual
doctests in each method (if doing so would require a lot of setup code
each time).
> I think it is not too bad to face the problem now, before it is too
> late, and at least give a general infrastructure for how doctest's
> fixtures will have to be in the future.
It won't be too late - if we continue to write effectively "stand
alone" doctests in each docstring, then if at some point we do need
more infrastructure to support more complicated doctests, the old
simple doctests will still work fine. I think you are inventing
unneeded work here. Also if we do add something complicated or
non-standard, it makes it harder if later on we do ever want to switch
test frameworks (e.g. to nose).
Peter
More information about the Biopython-dev
mailing list