Source

Kong / kongtests.py

Full commit
import doctest
import unittest
import pkgutil
import kong


def find_modules(module):
    path = getattr(module, '__path__')
    basename = module.__name__ + '.'
    for _, modname, ispkg in pkgutil.iter_modules(path):
        modname = basename + modname
        yield modname
        if ispkg:
            mod = reduce(getattr, modname.split('.')[1:], __import__(modname))
            for item in find_modules(mod):
                yield item


def suite():
    suite = unittest.TestSuite()
    for mod in find_modules(kong):
        suite.addTest(doctest.DocTestSuite(mod))
    return suite