handle message-outgoing events for zeroconf. We can now send messages in trunk. Fixes...
[gajim.git] / test / runtests.py
blob663f7d5b21c952327320f06e638a271220273da4
1 #!/usr/bin/env python
4 '''
5 Runs Gajim's Test Suite
7 Unit tests tests will be run on each commit.
8 '''
10 import sys
11 import unittest
12 import getopt
13 use_x = True
14 verbose = 1
16 try:
17 shortargs = 'hnv:'
18 longargs = 'help no-x verbose='
19 opts, args = getopt.getopt(sys.argv[1:], shortargs, longargs.split())
20 except getopt.error, msg:
21 print msg
22 print 'for help use --help'
23 sys.exit(2)
24 for o, a in opts:
25 if o in ('-h', '--help'):
26 print 'runtests [--help] [--no-x] [--verbose level]'
27 sys.exit()
28 elif o in ('-n', '--no-x'):
29 use_x = False
30 elif o in ('-v', '--verbose'):
31 try:
32 verbose = int(a)
33 except Exception:
34 print 'verbose must be a number >= 0'
35 sys.exit(2)
37 # new test modules need to be added manually
38 modules = ( 'unit.test_xmpp_dispatcher_nb',
39 'unit.test_xmpp_transports_nb',
40 'unit.test_protocol_caps',
41 'unit.test_caps_cache',
42 'unit.test_contacts',
43 'unit.test_sessions',
44 'unit.test_account',
45 'unit.test_gui_interface',
47 #modules = ()
49 if use_x:
50 modules += ('integration.test_gui_event_integration',
51 'integration.test_roster',
52 'integration.test_resolver',
53 'integration.test_xmpp_client_nb',
54 'integration.test_xmpp_transports_nb'
57 nb_errors = 0
58 nb_failures = 0
60 for mod in modules:
61 suite = unittest.defaultTestLoader.loadTestsFromName(mod)
62 result = unittest.TextTestRunner(verbosity=verbose).run(suite)
63 nb_errors += len(result.errors)
64 nb_failures += len(result.failures)
66 sys.exit(nb_errors + nb_failures)