Imported Upstream version 3.3.1
[platform/upstream/pygobject2.git] / tests / runtests-windows.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4
5 import os
6 import sys
7 import glob
8 import unittest
9
10 os.environ['PYGTK_USE_GIL_STATE_API'] = ''
11 sys.path.insert(0, os.path.dirname(__file__))
12 sys.argv.append('--g-fatal-warnings')
13
14 from gi.repository import GObject
15 GObject.threads_init()
16
17
18 SKIP_FILES = ['runtests',
19               'test_mainloop',      # no os.fork on windows
20               'test_subprocess']    # blocks on testChildWatch
21
22
23 if __name__ == '__main__':
24     testdir = os.path.split(os.path.abspath(__file__))[0]
25     os.chdir(testdir)
26
27     def gettestnames():
28         files = glob.glob('*.py')
29         names = map(lambda x: x[:-3], files)
30         map(names.remove, SKIP_FILES)
31         return names
32
33     suite = unittest.TestSuite()
34     loader = unittest.TestLoader()
35
36     for name in gettestnames():
37         try:
38             suite.addTest(loader.loadTestsFromName(name))
39         except Exception, e:
40             print 'Could not load %s: %s' % (name, e)
41
42     testRunner = unittest.TextTestRunner()
43     testRunner.verbosity = 2
44     testRunner.run(suite)