view test.py @ 171:72eee6a9f43f

making the data_generation folder (and subdirs) an importable module
author Dumitru Erhan <dumitru.erhan@gmail.com>
date Fri, 26 Feb 2010 15:25:01 -0500
parents 050c7ff6b449
children ff26436d42d6
line wrap: on
line source

import doctest, sys, pkgutil

def runTests(options = doctest.ELLIPSIS or doctest.DONT_ACCEPT_TRUE_FOR_1):
    import ift6266
    predefs = ift6266.__dict__
    for (_, name, ispkg) in pkgutil.walk_packages(ift6266.__path__, ift6266.__name__+'.'):
        if not ispkg:
            if name.startswith('ift6266.scripts') or \
               name in ['ift6266.test']:
                continue
            print "Testing:", name
            __import__(name)
            doctest.testmod(sys.modules[name], extraglobs=predefs, optionflags=options)

if __name__ == '__main__':
    runTests()