[Biopython-dev] Upcoming release

Brad Chapman chapmanb at arches.uga.edu
Sat Feb 24 17:02:34 EST 2001


Hey Jeff!

> The current plans are to have a release at the end of the month (next
> Wednesday!)  Please prepare to have all your code checked in by early next
> week.

Sounds good!
 
> - Brad, is there anything special that needs to be done with the docs?

I don't think so... unless people want to donate more documentation
:-). I think it would be nice to include a pdf version in the
distribution, unless people are opposed to this.
 
> - I'm not sure if Andrew is going to get around to making br_regrtest
> accept different newline conventions.  Does anyone want to have a go at
> fixing this, or should we punt until the next release?  Or, should we just
> scrap it altogether for PyUnit (definitely next release)?

I tried to fix br_regrtest, but didn't have any luck :-<. So I
implemented a top level test module using PyUnit that runs all of the
tests. This doesn't do any comparisons with the golden output right
now, but at least makes sure that the tests run. Right now I'm saving
the output from the test into a string using StringIO, so maybe
someone has an idea for expanding this to also do comparisons in a way 
that is easier to deal with different newlines. I'm stumped on that...

Anyways, let me know what you guys think about the script. BTW, you do
need to download PyUnit from:

http://pyunit.sourceforge.net

and put unittest.py in the test directory. We can include this in the
distribution without a problem, so it won't be an extra download once
we do this.

> Let me know if there are other outstanding issues.

The only test that is failing for me with this script is Unigene -- it 
is looking for unigene_format.py, which isn't in CVS for me -- maybe
this is something that still needs to be checked in. Cayte?

Brad

-------------- next part --------------
#!/usr/bin/env python
"""Run the biopython tests as a set of PyUnit tests.

This is the top level function for running all tests.
"""
# standard modules
import sys
import cStringIO
import os

# PyUnit
import unittest

def run_tests(argv):
    all_tests = findtests()
    test_suite = unittest.TestSuite()

    for test in all_tests:
        class BiopythonTest(unittest.TestCase):
            def __init__(self, test_name):
                unittest.TestCase.__init__(self)
                self.test_name = test_name

            def shortDescription(self):
                return self.test_name
            
            def runTest(self):
                output = cStringIO.StringIO()

                # remember standard out so we can reset it after we are done
                save_stdout = sys.stdout
                try:
                    # write the output from the test into a string
                    sys.stdout = output
                    __import__(self.test_name)
                finally:
                    # return standard out to its normal setting
                    sys.stdout = save_stdout
        
        # run the test as a PyUnit test
        test_suite.addTest(BiopythonTest(test))

    runner = unittest.TextTestRunner()
    runner.run(test_suite)

def findtests():
    """Return a list of all applicable test modules."""
    testdir = findtestdir()
    names = os.listdir(testdir)
    tests = []
    for name in names:
        if name[:5] == "test_" and name[-3:] == ".py":
	    tests.append(name[:-3])
    tests.sort()
    return tests

def findtestdir():
    if __name__ == '__main__':
        file = sys.argv[0]
    else:
        file = __file__
    testdir = os.path.dirname(file) or os.curdir
    return testdir
                
if __name__ == "__main__":
    sys.exit(run_tests(sys.argv))


More information about the Biopython-dev mailing list