[Biopython-dev] run_tests.py rewrite

Peter biopython at maubp.freeserve.co.uk
Tue Feb 3 13:12:51 UTC 2009


On Tue, Feb 3, 2009 at 12:26 PM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
> Maybe it was a mistake to call this a rewrite ...

With hindsight, it did give the impression of something bigger
happening.  Oh well.

> ... basically all I'm doing is making some changes in run_tests.py so that it will
> distinguish between unittest-style tests and print-and-compare tests, and
> cleaning up some code while I'm at it.

In terms of cleaning up the code, something we can probably now remove
from the print-and-compare handler is the special case of modules
called via a run_tests method.  I'd like to suggest removing this bit
(lines 167 to 171 at the moment):

            try:
                cur_test.run_tests([])
            except AttributeError:
                pass

[As an aside, using a hasattr(module,"run_tests") would be safer in
case the test itself raised an AttributeError.  If we remove this code
it doesn't matter.]

Currently I think only test_GAQueens.py requires this "magic" which
can be solved by making it explicitly default to running with five
queens.  Right now it is not at all clear from looking at this example
how this default happens if run via run_tests.py but not when running
test_GAQueens.py on its own.  The only other print-and-compare module
I found with a run_tests function is test_NNExclusiveOr.py but here it
makes no difference as the same code gets called via the __main__
trick.

Peter



More information about the Biopython-dev mailing list