File: regression.py

package info (click to toggle)
diveintopython3 20110517%2B77958af-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,104 kB
  • sloc: python: 2,201; xml: 189; makefile: 45
file content (15 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/python3

import unittest
import os
import glob

def regressionTest():
    filenames = glob.glob('*test*.py')
    module_names = [os.path.splitext(os.path.basename(f))[0] for f in filenames]
    modules = [__import__(name) for name in module_names]
    tests = [unittest.defaultTestLoader.loadTestsFromModule(m) for m in modules]
    return unittest.TestSuite(tests)

if __name__ == '__main__':
    unittest.main(defaultTest='regressionTest')