Merge commit 'remotes/ctb/xmlrpc_patches' into tryme
[pygr.git] / tests / doctests_test.py
blobc3b36fa5d5f0547613802d9e493303856184b735
1 """
2 Run all of the doctests in the doc/*.rest files.
3 """
4 import os, os.path
5 from testlib import testutil
6 import unittest, doctest
8 def codetest():
9 "Test the code here before adding to doctest @CTB"
10 import pygr
11 from pygr.seqdb import SequenceFileDB
12 db = SequenceFileDB(os.path.join('data', 'partial-yeast.fasta'))
13 chr02 = db['chr02']
14 start, stop = (87787, 86719)
15 x = chr02[start:stop]
17 def get_suite():
18 suite = unittest.TestSuite()
20 names = [
21 # 'contents.rst',
22 # 'sequences.rst',
23 # 'contrib%sfetch.rst' % os.path.sep, @CTB does not work on my system?
24 # 'recipes%spygrdata_recipes.rst' % os.path.sep,
25 # 'recipes%salignment_recipes.rst' % os.path.sep,
28 # needs relative paths for some reason
29 doctestpath = os.path.join('..', 'doc', 'rest')
30 paths = [ os.path.join(doctestpath, name) for name in names ]
32 for path in paths:
33 docsuite = doctest.DocFileSuite(path)
34 suite.addTest(docsuite)
36 return suite
38 if __name__ == '__main__':
39 #codetest()
40 suite = get_suite()
41 runner = unittest.TextTestRunner(verbosity=2)
42 runner.run(suite)