6 basedir = os.path.realpath(os.path.dirname(__file__))
7 unittestsdir = os.path.join( \
13 fullsuite = unittest.TestSuite()
15 # walk our directory tree looking for any modules available
16 for root, dir, files in os.walk(unittestsdir):
18 if file[-3:] == ".py" and file != "__init__.py":
19 moduleinfo = ".".join(root[len(basedir)+1:].split(os.sep))
20 unittestmodules.append(".".join((moduleinfo, file[0:-3])))
22 # run through the found modules and look for test suites
23 for unittestmodule in unittestmodules:
24 # try importing the test and getting the suite
26 suite_func = getattr(__import__(unittestmodule, {}, {}, ['']), "suite")
27 # add the suite to the tests
28 fullsuite.addTest(suite_func())
30 # there was not test suite in there to run, skip it
33 testrunner = unittest.TextTestRunner()
34 testrunner.run(fullsuite)