[Biopython-dev] Fwd: Unit tests

Brad Chapman chapmanb at arches.uga.edu
Tue Nov 6 20:15:12 EST 2001


Hi Gavin;

> I have been working on updating the SCOP module. 

Great!

> Now, I am a big fan of unit tests, and I find myself writing 
> unit tests for almost everything. 

Me too. My testing ability has improved dramatically since starting
on biopython -- and now for all of my independent work (and
biopython-corba), I code unit tests like crazy.

> I am having problems understanding how to integrate my tests 
> into biopythons framework. Most of the things in biopython/tests 
> appear to be regression tests with a PyUnit coating.

Yes, I used PyUnit to build up the regression testing framework
(based heavily on the regression tests that Andrew already had). I
mostly just use PyUnit to deal with printing the output, etc, but it
is definately a regression test framework. The regression testing
framework and integrating tests into it is described on a wiki page:

http://biopython.org/wiki/html/BioPython/RegressionTests.html

(damn, this still uses br_regression.py instead of run_tests.py. I
need to update this).

> After looking around a bit, I found this unit test description from Zope.
[...]
> I think this would be a good way to organize biopythons unit tests. 
> Thoughts? Comments?

I think it's great to write an individual test for a module
(test_whatever.py) in whatever way you feel most comfortable with. I
agree with Jeff that we don't want to rewrite all of the tests now
(gack!) but definately feel free to write new tests as Unit Tests,
they will still plug into the high-level regression testing
framework just fine.

Personally, I think that although the regression test stuff can be a
pain sometimes, it is quite useful for tests like the BLAST output
tests or the GenBank tests. It is much easier to dump the output of
a parse to a file and make sure it remains the same then to
individually have 'assert genbank_record.locus == "WHATEVER"' for
a hundred different attributes on a record.

So, I guess I don't think there is a need to be heavy-handed about
how you "have" to do tests. Personally, I'd rather leave it up to
the individual person writing the tests.

The-important-thing-is-having-some-tests-ly yr's,
Brad
-- 
PGP public key available from http://pgp.mit.edu/



More information about the Biopython-dev mailing list