1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
#!/usr/bin/env python
import os
import glob
import sys
import inspect
import unittest
myself = os.path.abspath(__file__)
testdir = os.path.dirname(myself)
if testdir not in sys.path:
sys.path.append(testdir)
sys.path.insert(0, os.path.join(testdir, '..'))
print 'Running tests on', testdir
from kiwi.environ import require_gazpacho
require_gazpacho()
suite = unittest.TestSuite()
for file in glob.glob(os.path.join(testdir, 'test_*.py')):
filename = os.path.basename(file)
modulename = os.path.splitext(filename)[0]
mod = __import__(modulename, globals(), locals())
members = [mem[1] for mem in inspect.getmembers(mod, inspect.isclass) \
if issubclass(mem[1], unittest.TestCase) \
and not mem[1] == unittest.TestCase]
for mem in members:
suite.addTest(unittest.makeSuite(mem))
unittest.TextTestRunner(verbosity=2).run(suite)
|