2 # -*- coding: utf-8 -*-
10 mydir
= os
.path
.dirname(os
.path
.abspath(__file__
))
11 tests_builddir
= os
.path
.abspath(os
.environ
.get('TESTS_BUILDDIR', os
.path
.dirname(__file__
)))
12 builddir
= os
.path
.dirname(tests_builddir
)
14 # we have to do this here instead of Makefile.am so that the implicitly added
15 # directory for the source file comes after the builddir
16 sys
.path
.insert(0, tests_builddir
)
17 sys
.path
.insert(0, builddir
)
19 os
.environ
['PYGTK_USE_GIL_STATE_API'] = ''
20 sys
.argv
.append('--g-fatal-warnings')
22 from gi
.repository
import GObject
23 GObject
.threads_init()
26 SKIP_FILES
= ['runtests',
27 'test_mainloop', # no os.fork on windows
28 'test_subprocess'] # blocks on testChildWatch
31 if __name__
== '__main__':
32 testdir
= os
.path
.split(os
.path
.abspath(__file__
))[0]
36 files
= glob
.glob('*.py')
37 names
= map(lambda x
: x
[:-3], files
)
38 map(names
.remove
, SKIP_FILES
)
41 suite
= unittest
.TestSuite()
42 loader
= unittest
.TestLoader()
44 for name
in gettestnames():
46 suite
.addTest(loader
.loadTestsFromName(name
))
47 except Exception as e
:
48 print('Could not load %s: %s' % (name
, e
))
50 testRunner
= unittest
.TextTestRunner()
51 testRunner
.verbosity
= 2