blob: bda609048a0d808b1a5c9b42cde2e452b9fa0140 [file] [log] [blame]
Joe Gregorio48d361f2010-08-18 13:19:21 -04001#!/usr/bin/env python
2import glob, unittest, os, sys
3
4from trace import fullmodname
5try:
6 from tests.utils import cleanup
7except:
8 def cleanup():
9 pass
10
11sys.path.insert(0, os.getcwd())
12
13# find all of the test modules
14modules = map(fullmodname, glob.glob(os.path.join('tests', 'test_*.py')))
15print "Running the tests found in the following modules:"
16print modules
17
18# load all of the tests into a suite
19try:
20 suite = unittest.TestLoader().loadTestsFromNames(modules)
21except Exception, exception:
22 # attempt to produce a more specific message
23 for module in modules:
24 __import__(module)
25 raise
26
27verbosity = 1
28if "-q" in sys.argv or '--quiet' in sys.argv:
29 verbosity = 0
30if "-v" in sys.argv or '--verbose' in sys.argv:
31 verbosity = 2
32
33# run test suite
34unittest.TextTestRunner(verbosity=verbosity).run(suite)
35
36cleanup()
37