[Biopython-dev] The Status of the Tests

Jeffrey Chang jchang at smi.stanford.edu
Wed Nov 27 03:59:14 EST 2002


I had been noticing some odd failures in test_format_registry and
test_align.  Basically, they would fail when running the whole
regression suite.  However, if run separately (python run_tests
test_align), they worked.

It turns out that this is due to a bug in the interface between the
regression testing framework and some code in Biopython.  The problem
stems from functions (or class methods) defined as:
def foobar(outhandle=sys.stdout, ...)
  ...

This conflicted with the regression tests, because the regression
tests reassigned sys.stdout.  The outhandle parameter in the foobar
function was getting bound to the old value of sys.stdout when
imported.  The fix was to change occurrences of this to:
def foobar(outhandle=None, ...)
  outhandle = outhandle or sys.stdout

Written this way, outhandle will get bound when the function is
called, rather than when the module is first imported.

I've checked these fixes in.  test_format_registry and test_align are
now happy again!

Jeff



More information about the Biopython-dev mailing list