2008-08-09 01:53:44 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
2008-12-24 14:43:42 +01:00
|
|
|
|
|
|
|
'''
|
|
|
|
Runs Gajim's Test Suite
|
|
|
|
|
|
|
|
Non GUI related tests will be run on each commit.
|
|
|
|
'''
|
|
|
|
|
2008-08-27 09:55:06 +02:00
|
|
|
import sys
|
2008-08-09 01:53:44 +02:00
|
|
|
import unittest
|
2008-08-27 09:55:06 +02:00
|
|
|
import getopt
|
|
|
|
use_x = True
|
|
|
|
verbose = 1
|
|
|
|
|
|
|
|
try:
|
|
|
|
shortargs = 'hnv:'
|
|
|
|
longargs = 'help no-x verbose='
|
|
|
|
opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs.split())
|
|
|
|
except getopt.error, msg:
|
|
|
|
print msg
|
|
|
|
print 'for help use --help'
|
|
|
|
sys.exit(2)
|
|
|
|
for o, a in opts:
|
|
|
|
if o in ('-h', '--help'):
|
|
|
|
print 'runtests [--help] [--no-x] [--verbose level]'
|
|
|
|
sys.exit()
|
|
|
|
elif o in ('-n', '--no-x'):
|
|
|
|
use_x = False
|
|
|
|
elif o in ('-v', '--verbose'):
|
|
|
|
try:
|
|
|
|
verbose = int(a)
|
2008-10-11 11:37:13 +02:00
|
|
|
except Exception:
|
2008-08-27 09:55:06 +02:00
|
|
|
print 'verbose must be a number >= 0'
|
2008-08-27 20:55:18 +02:00
|
|
|
sys.exit(2)
|
2008-08-09 01:53:44 +02:00
|
|
|
|
|
|
|
# new test modules need to be added manually
|
2008-12-24 14:43:42 +01:00
|
|
|
modules = ()
|
2008-08-27 09:55:06 +02:00
|
|
|
|
|
|
|
if use_x:
|
|
|
|
modules += ('test_misc_interface',
|
|
|
|
'test_roster',
|
|
|
|
'test_sessions',
|
2008-12-24 14:43:42 +01:00
|
|
|
'test_resolver',
|
|
|
|
'test_caps',
|
|
|
|
'test_dispatcher_nb',
|
|
|
|
'test_nonblockingtcp',
|
2008-08-27 09:55:06 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
nb_errors = 0
|
|
|
|
nb_failures = 0
|
|
|
|
|
2008-08-09 01:53:44 +02:00
|
|
|
for mod in modules:
|
|
|
|
suite = unittest.defaultTestLoader.loadTestsFromName(mod)
|
2008-08-27 09:55:06 +02:00
|
|
|
result = unittest.TextTestRunner(verbosity=verbose).run(suite)
|
|
|
|
nb_errors += len(result.errors)
|
|
|
|
nb_failures += len(result.failures)
|
|
|
|
|
|
|
|
sys.exit(nb_errors + nb_failures)
|
2008-08-09 01:53:44 +02:00
|
|
|
|
|
|
|
# vim: se ts=3:
|