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
|
|
|
|
|
2009-11-05 09:06:46 +01:00
|
|
|
Unit tests tests will be run on each commit.
|
2008-12-24 14:43:42 +01:00
|
|
|
'''
|
|
|
|
|
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:
|
2010-02-08 15:08:40 +01:00
|
|
|
shortargs = 'hnv:'
|
|
|
|
longargs = 'help no-x verbose='
|
|
|
|
opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs.split())
|
2008-08-27 09:55:06 +02:00
|
|
|
except getopt.error, msg:
|
2010-02-08 15:08:40 +01:00
|
|
|
print msg
|
|
|
|
print 'for help use --help'
|
|
|
|
sys.exit(2)
|
2008-08-27 09:55:06 +02:00
|
|
|
for o, a in opts:
|
2010-02-08 15:08:40 +01:00
|
|
|
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)
|
|
|
|
except Exception:
|
|
|
|
print 'verbose must be a number >= 0'
|
|
|
|
sys.exit(2)
|
2008-08-09 01:53:44 +02:00
|
|
|
|
|
|
|
# new test modules need to be added manually
|
2009-11-05 09:06:46 +01:00
|
|
|
modules = ( 'unit.test_xmpp_dispatcher_nb',
|
2010-08-27 11:47:38 +02:00
|
|
|
'unit.test_xmpp_transports_nb',
|
|
|
|
'unit.test_protocol_caps',
|
|
|
|
'unit.test_caps_cache',
|
|
|
|
'unit.test_contacts',
|
|
|
|
'unit.test_sessions',
|
|
|
|
'unit.test_account',
|
|
|
|
'unit.test_gui_interface',
|
|
|
|
)
|
2009-04-06 20:34:20 +02:00
|
|
|
#modules = ()
|
2008-08-27 09:55:06 +02:00
|
|
|
|
|
|
|
if use_x:
|
2010-02-08 15:08:40 +01:00
|
|
|
modules += ('integration.test_gui_event_integration',
|
2010-08-27 11:47:38 +02:00
|
|
|
'integration.test_roster',
|
|
|
|
'integration.test_resolver',
|
|
|
|
'integration.test_xmpp_client_nb',
|
|
|
|
'integration.test_xmpp_transports_nb'
|
|
|
|
)
|
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:
|
2010-02-08 15:08:40 +01:00
|
|
|
suite = unittest.defaultTestLoader.loadTestsFromName(mod)
|
|
|
|
result = unittest.TextTestRunner(verbosity=verbose).run(suite)
|
|
|
|
nb_errors += len(result.errors)
|
|
|
|
nb_failures += len(result.failures)
|
2008-08-27 09:55:06 +02:00
|
|
|
|
|
|
|
sys.exit(nb_errors + nb_failures)
|