1 """Regression testing framework
3 This module will search for scripts in the same directory named
4 XYZtest.py. Each such script should be a test suite that tests a
5 module through PyUnit. (As of Python 2.1, PyUnit is included in
6 the standard library as "unittest".) This script will aggregate all
7 found test suites into one big test suite and run them all at once.
10 import sys, os, re, unittest
11 import native_libvlc_test
14 def printAndRun( module ):
15 # print "Running tests from module " + module.__name__;
16 return unittest.defaultTestLoader.loadTestsFromModule( module )
19 path = os.path.abspath(os.path.dirname(sys.argv[0]))
20 files = os.listdir(path)
21 test = re.compile("test.py$", re.IGNORECASE)
22 files = filter(test.search, files)
23 filenameToModuleName = lambda f: os.path.splitext(f)[0]
24 moduleNames = map(filenameToModuleName, files)
25 modules = map(__import__, moduleNames)
27 native_libvlc_test.init()
29 # load = unittest.defaultTestLoader.loadTestsFromModule
31 return unittest.TestSuite(map(load, modules))
33 if __name__ == "__main__":
34 unittest.main(defaultTest="regressionTest")