]> git.sesse.net Git - vlc/blob - test/test.py
update module LIST file.
[vlc] / test / test.py
1 """Regression testing framework
2
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.
8 """
9
10 import sys, os, re, unittest
11 import native_libvlc_test
12
13
14 def printAndRun( module ):
15 #    print "Running tests from module " + module.__name__;
16     return unittest.defaultTestLoader.loadTestsFromModule( module )
17
18 def regressionTest():
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)                 
26     
27     native_libvlc_test.init()
28
29 #    load = unittest.defaultTestLoader.loadTestsFromModule
30     load = printAndRun
31     return unittest.TestSuite(map(load, modules))        
32
33 if __name__ == "__main__":
34     unittest.main(defaultTest="regressionTest")