annotate test.py @ 160:68160fd149fe

Simple script to doctest all modules beneath ift6266. This ecxcludes scripts since most of the files launch computations when imported and some even start a lot of jobs on the cluster (This happened to me when testing).
author Arnaud Bergeron <abergeron@gmail.com>
date Thu, 25 Feb 2010 17:27:49 -0500
parents
children c1d5474c3386
rev   line source
160
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
1 import doctest, sys, pkgutil
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
2
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
3 def runTests(options = doctest.ELLIPSIS or doctest.DONT_ACCEPT_TRUE_FOR_1):
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
4 import ift6266
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
5 predefs = ift6266.__dict__
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
6 for (_, name, ispkg) in pkgutil.walk_packages(ift6266.__path__, ift6266.__name__+'.'):
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
7 if not ispkg:
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
8 if name.startswith('ift6266.scripts'):
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
9 continue
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
10 print "Testing:", name
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
11 __import__(name)
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
12 doctest.testmod(sys.modules[name], extraglobs=predefs, optionflags=options)
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
13
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
14 if __name__ == '__main__':
68160fd149fe Simple script to doctest all modules beneath ift6266.
Arnaud Bergeron <abergeron@gmail.com>
parents:
diff changeset
15 runTests()