diff options
-rwxr-xr-x | setup.py | 48 | ||||
-rw-r--r-- | tests/common-windows.py | 23 | ||||
-rw-r--r-- | tests/runtests-windows.py | 39 |
3 files changed, 110 insertions, 0 deletions
@@ -94,6 +94,9 @@ class PyGtkInstallLib(InstallLib): install_dir = os.path.join(self.install_dir, PYGTK_SUFFIX_LONG) self.set_install_dir(install_dir) + # Install tests + self.install_tests() + InstallLib.run(self) def install_pth(self): @@ -104,6 +107,51 @@ class PyGtkInstallLib(InstallLib): self.local_outputs.append(file) self.local_inputs.append('pygtk.pth') + def copy_test(self, srcfile, dstfile=None): + if dstfile is None: + dstfile = os.path.join(self.test_dir, srcfile) + else: + dstfile = os.path.join(self.test_dir, dstfile) + + srcfile = os.path.join('tests', srcfile) + + self.copy_file(srcfile, os.path.abspath(dstfile)) + self.local_outputs.append(dstfile) + self.local_inputs.append('srcfile') + + def install_tests(self): + self.test_dir = os.path.join(self.install_dir, 'tests', 'pygtk') + self.mkpath(self.test_dir) + + self.copy_test('runtests-windows.py', 'runtests.py') + self.copy_test('common-windows.py', 'common.py') + self.copy_test('test_accel_closures.py') + self.copy_test('test_actiongroup.py') + self.copy_test('test_api.py') + self.copy_test('test_bin.py') + self.copy_test('test_button.py') + self.copy_test('test_color.py') + self.copy_test('test_container.py') + self.copy_test('test_conversion.py') + self.copy_test('test_dialog.py') + self.copy_test('test_enum.py') + self.copy_test('test_filechooserdialog.py') + self.copy_test('test_gdk.py') + self.copy_test('test_gdkevent.py') + self.copy_test('test_glade.py') + self.copy_test('leak.glade') + self.copy_test('test_liststore.py') + self.copy_test('test_pango.py') + self.copy_test('test_plug.py') + self.copy_test('test_radiobutton.py') + self.copy_test('test_scalebutton.py') + self.copy_test('test_rectangle.py') + self.copy_test('test_style.py') + self.copy_test('test_textview.py') + self.copy_test('test_treeview.py') + self.copy_test('testmodule.py') + + class PyGtkInstallData(InstallData): def run(self): self.add_template_option('VERSION', VERSION) diff --git a/tests/common-windows.py b/tests/common-windows.py new file mode 100644 index 00000000..d3babf0b --- /dev/null +++ b/tests/common-windows.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + + +import os +import sys + +import gobject + +sys.path.insert(0, os.path.dirname(__file__)) +sys.argv.append('--g-fatal-warnings') + +import atk +import pango +import gtk +import gtk.gdk + +try: + import gtk.glade +except ImportError: + print ('* gtk.glade is not available.') + +os.environ['PYGTK_USE_GIL_STATE_API'] = '' +gobject.threads_init() diff --git a/tests/runtests-windows.py b/tests/runtests-windows.py new file mode 100644 index 00000000..495f6ed6 --- /dev/null +++ b/tests/runtests-windows.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+
+import os
+import sys
+import glob
+import unittest
+
+import common
+
+
+SKIP_FILES = ['runtests',
+ 'common']
+# 'test_glade'] # python crash
+
+
+if __name__ == '__main__':
+ dir = os.path.split(os.path.abspath(__file__))[0]
+ os.chdir(dir)
+
+ def gettestnames():
+ files = glob.glob('*.py')
+ names = map(lambda x: x[:-3], files)
+ map(names.remove, SKIP_FILES)
+ return names
+
+ suite = unittest.TestSuite()
+ loader = unittest.TestLoader()
+
+ for name in gettestnames():
+ try:
+ suite.addTest(loader.loadTestsFromName(name))
+ except Exception, e:
+ print 'Could not load %s: %s' % (name, e)
+
+ testRunner = unittest.TextTestRunner()
+ testRunner.verbosity = 2
+ testRunner.run(suite)
|