[Biopython-dev] [Bug 2640] Proposal: doctest for SeqRecord/biopython

bugzilla-daemon at portal.open-bio.org bugzilla-daemon at portal.open-bio.org
Wed Nov 5 12:06:04 UTC 2008


http://bugzilla.open-bio.org/show_bug.cgi?id=2640





------- Comment #7 from biopython-bugzilla at maubp.freeserve.co.uk  2008-11-05 07:06 EST -------
I've updated Bio.Seq, Bio.SeqIO and Bio.AlignIO so my existing docstring
examples can be used with doctest.

Adding code via the __main__ trick to allow each module's test to be run
individually might be worthwhile.

The rest of this message is a possible "test_docstrings.py" file for our unit
tests, which would require manual updating whenever we want to test a
additional module.  This is probably a neat short term solution while only a
relatively small proportion of Biopython uses doctests.

-----------------------------------------------------------------
#!/usr/bin/env python
# This code is part of the Biopython distribution and governed by its
# license.  Please see the LICENSE file that should have been included
# as part of this package.

import doctest, unittest

from Bio import Seq, SeqRecord, SeqIO, AlignIO
test_modules = [Seq, SeqRecord, SeqIO, AlignIO]

test_suite = unittest.TestSuite((doctest.DocTestSuite(module) \
                                 for module in test_modules))

#Using sys.stdout prevent this working nicely when run from idle:
#runner = unittest.TextTestRunner(sys.stdout, verbosity = 0)

#Using verbosity = 0 means we won't have to regenerate the unit
#test output file used by the run_tests.py framework whenever a
#new module or doctest is added.
runner = unittest.TextTestRunner(verbosity = 0)
runner.run(test_suite)


-- 
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the Biopython-dev mailing list