]> git.sesse.net Git - vlc/blob - test/test.py
* modules/codec/ffmpeg/audio.c: reduce memory usage a bit.
[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
12 def printAndRun( module ):
13     print "Running tests from module " + module.__name__;
14     return unittest.defaultTestLoader.loadTestsFromModule( module )
15
16 def regressionTest():
17     path = os.path.abspath(os.path.dirname(sys.argv[0]))
18     files = os.listdir(path)                    
19     test = re.compile("test.py$", re.IGNORECASE)
20     files = filter(test.search, files)          
21     filenameToModuleName = lambda f: os.path.splitext(f)[0]
22     moduleNames = map(filenameToModuleName, files)         
23     modules = map(__import__, moduleNames)                 
24 #    load = unittest.defaultTestLoader.loadTestsFromModule
25     load = printAndRun
26     return unittest.TestSuite(map(load, modules))        
27
28 if __name__ == "__main__":
29     unittest.main(defaultTest="regressionTest")