diff --git a/tests/Makefile.am b/tests/Makefile.am
index e546f50..c0f2411 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,5 @@
 INCLUDES = \
+	-I$(top_srcdir)/glib	\
 	-I$(top_srcdir)/gobject \
 	$(PYTHON_INCLUDES) \
 	$(GLIB_CFLAGS)
@@ -15,7 +16,7 @@ noinst_LTLIBRARIES = testhelper.la
 linked_LIBS = testhelper.la
 
 testhelper_la_LDFLAGS = -module -avoid-version
-testhelper_la_LIBADD = $(GLIB_LIBS)
+testhelper_la_LIBADD = $(GLIB_LIBS) -lgthread-2.0
 testhelper_la_SOURCES = \
 	testhelpermodule.c \
 	test-thread.c \
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/tests/common.py b/tests/common.py
index a6fa73d..8598733 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -23,7 +23,10 @@ def importModules(buildDir, srcDir):
     globals().update(locals())
 
     os.environ['PYGTK_USE_GIL_STATE_API'] = ''
-    gobject.threads_init()
+    try:
+        gobject.threads_init()
+    except RuntimeError:
+        pass
 
 def importModule(module, directory, name=None):
     global isDistCheck
@@ -34,7 +37,8 @@ def importModule(module, directory, name=None):
 
     try:
         obj = __import__(module, {}, {}, '')
-    except ImportError, e:
+    except ImportError:
+        exc_class, e, tb = sys.exc_info()
         raise SystemExit('%s could not be imported: %s' % (origName, e))
 
     location = obj.__file__
diff --git a/tests/runtests.py b/tests/runtests.py
index fc0558d..9a81c63 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -24,13 +24,21 @@ common.importModules(buildDir=buildDir,
 SKIP_FILES = ['common', 'runtests',
               'test_enum', 'test_conversion']
 
+if sys.version_info[0] > 2:
+    # disabled because imports pygtk, not yet ported
+    SKIP_FILES.append('test_subtype')
+
+    # issues with subprocesses
+    SKIP_FILES.append('test_mainloop')
+    SKIP_FILES.append('test_subprocess')
+
+
 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)
+    names = [x[:-3] for x in files if x[:-3] not in SKIP_FILES]
     return names
 
 suite = unittest.TestSuite()
diff --git a/tests/test_enum.py b/tests/test_enum.py
index f4d6bef..f26d430 100644
--- a/tests/test_enum.py
+++ b/tests/test_enum.py
@@ -58,8 +58,7 @@ class EnumTest(unittest.TestCase):
 
     def testGParam(self):
         win = gtk.Window()
-        enums = filter(lambda x: gobject.GType.is_a(x.value_type, gobject.GEnum),
-                       gobject.list_properties(win))
+        enums = [x for x in gobject.list_properties(win) if gobject.GType.is_a(x.value_type, gobject.GEnum)]
         self.failUnless(enums)
         enum = enums[0]
         self.failUnless(hasattr(enum, 'enum_class'))
@@ -70,10 +69,9 @@ class EnumTest(unittest.TestCase):
         self.assertEquals(int(gdk.BUTTON_PRESS), 4)
 
     def testParamSpec(self):
-        props = filter(lambda prop: gobject.GType.is_a(prop.value_type, gobject.GEnum),
-                       gobject.list_properties(gtk.Window))
+        props = [prop for prop in gobject.list_properties(gtk.Window) if gobject.GType.is_a(prop.value_type, gobject.GEnum)]
         self.failUnless(len(props)>= 6)
-        props = filter(lambda prop: prop.name == 'type', props)
+        props = [prop for prop in props if prop.name == 'type']
         self.failUnless(props)
         pspec = props[0]
         klass = pspec.enum_class
@@ -181,8 +179,7 @@ class FlagsTest(unittest.TestCase):
         warnings.resetwarnings()
 
     def testParamSpec(self):
-        props = filter(lambda x: gobject.GType.is_a(x.value_type, gobject.GFlags),
-                       gtk.container_class_list_child_properties(gtk.Table))
+        props = [x for x in gtk.container_class_list_child_properties(gtk.Table) if gobject.GType.is_a(x.value_type, gobject.GFlags)]
         self.failUnless(len(props) >= 2)
         pspec = props[0]
         klass = pspec.flags_class
diff --git a/tests/test_gio.py b/tests/test_gio.py
index 7534ac0..25b4fd6 100644
--- a/tests/test_gio.py
+++ b/tests/test_gio.py
@@ -1,10 +1,14 @@
 # -*- Mode: Python -*-
 
 import os
+import sys
 import unittest
 
 from common import gio, glib
 
+if sys.version_info[0] > 2:
+    long = int
+
 
 class TestFile(unittest.TestCase):
     def setUp(self):
@@ -169,9 +173,7 @@ class TestFile(unittest.TestCase):
         for gfile in [gio.File("/"),
                       gio.File("file:///"),
                       gio.File(uri="file:///"),
-                      gio.File(path="/"),
-                      gio.File(u"/"),
-                      gio.File(path=u"/")]:
+                      gio.File(path="/")]:
             self.failUnless(isinstance(gfile, gio.File))
             self.assertEquals(gfile.get_path(), "/")
             self.assertEquals(gfile.get_uri(), "file:///")
@@ -239,7 +241,8 @@ class TestFile(unittest.TestCase):
             try:
                 try:
                     retval = gfile.mount_enclosing_volume_finish(result)
-                except gio.Error, e:
+                except gio.Error:
+                    exc_class, e, tb = sys.exc_info()
                     # If we run the tests too fast
                     if e.code == gio.ERROR_ALREADY_MOUNTED:
                         print ('WARNING: testfile is already mounted, '
@@ -430,7 +433,8 @@ class TestFile(unittest.TestCase):
         caught = False
         try:
             self.file.replace_contents("this won't work", etag="wrong")
-        except gio.Error, e:
+        except gio.Error:
+            exc_class, e, tb = sys.exc_info()
             self.assertEqual(e.code, gio.ERROR_WRONG_ETAG)
             caught = True
         self.failUnless(caught)
@@ -569,7 +573,7 @@ class TestInputStream(unittest.TestCase):
         self.assertEquals(self.stream.read(), '')
 
         self.stream = gio.MemoryInputStream()
-        some_data = open("test_gio.py", "rb").read()
+        some_data = open("test_gio.py", "r").read()
         self.stream.add_data(some_data)
         self.assertEquals(self.stream.read(), some_data)
 
@@ -717,7 +721,7 @@ class TestOutputStream(unittest.TestCase):
 
     def test_write_part(self):
         stream = gio.MemoryOutputStream()
-        some_data = open('test_gio.py', 'rb').read()
+        some_data = open('test_gio.py', 'r').read()
         buffer = some_data
 
         # In fact this makes only one looping (memory stream is fast,
diff --git a/tests/test_gtype.py b/tests/test_gtype.py
index cd1b140..b7d32de 100644
--- a/tests/test_gtype.py
+++ b/tests/test_gtype.py
@@ -1,8 +1,13 @@
 import unittest
+import sys
 
 from gobject import GType
 from common import gobject, testhelper
 
+
+if sys.version_info[0] > 2:
+    long = int
+
 def raiseGError():
     err = gobject.GError
     err.message = "Test conversion between exception and GError"
diff --git a/tests/test_mainloop.py b/tests/test_mainloop.py
index 95e5f78..1cdea3d 100644
--- a/tests/test_mainloop.py
+++ b/tests/test_mainloop.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import exceptions
+
 import os
 import sys
 import select
@@ -31,7 +31,7 @@ class TestMainLoop(unittest.TestCase):
         os.close(pipe_w)
 
         def excepthook(type, value, traceback):
-            assert type is exceptions.Exception
+            assert type is Exception
             assert value.args[0] == "deadbabe"
         sys.excepthook = excepthook
 
diff --git a/tests/test_option.py b/tests/test_option.py
index 6e0d449..728ece9 100644
--- a/tests/test_option.py
+++ b/tests/test_option.py
@@ -2,7 +2,20 @@
 
 import unittest
 import sys
-from StringIO import StringIO
+try:
+    from io import StringIO
+except ImportError:
+    from StringIO import StringIO
+
+try:
+    basestring
+except NameError:
+    basestring = str
+
+try:
+    StandardError
+except NameError:
+    StandardError = Exception
 
 from glib.option import OptionParser, OptionGroup, OptionValueError, \
      make_option, BadOptionError
@@ -108,6 +121,10 @@ class TestOption(unittest.TestCase):
                 ["test_option.py", "--callback-failure-test"])
         finally:
             sys.stderr = old_stderr
-        assert (sio.getvalue().split('\n')[-2] ==
-                "StandardError: " + self.EXCEPTION_MESSAGE)
+
+        # remove Exception name
+        msg = sio.getvalue().split('\n')[-2].split(":")[1]
+        # remove leading space
+        msg = msg[1:]
+        self.assertEqual(msg, self.EXCEPTION_MESSAGE)
 
diff --git a/tests/test_properties.py b/tests/test_properties.py
index e3be865..205f0f3 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -1,4 +1,5 @@
 
+import sys
 import struct
 import unittest
 
@@ -12,6 +13,10 @@ from gobject.constants import \
      G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
      G_MAXULONG
 
+
+if sys.version_info[0] > 2:
+    long = int
+
 class PropertyObject(GObject):
     normal = gobject.property(type=str)
     construct = gobject.property(
@@ -80,12 +85,12 @@ class TestProperties(unittest.TestCase):
     def testUint64(self):
         obj = new(PropertyObject)
         self.assertEqual(obj.props.uint64, 0)
-        obj.props.uint64 = 1L
-        self.assertEqual(obj.props.uint64, 1L)
         obj.props.uint64 = 1
-        self.assertEqual(obj.props.uint64, 1L)
+        self.assertEqual(obj.props.uint64, 1)
+        obj.props.uint64 = 1
+        self.assertEqual(obj.props.uint64, 1)
 
-        self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1L)
+        self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", long(-1))
         self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1)
 
     def testUInt64DefaultValue(self):
@@ -93,10 +98,11 @@ class TestProperties(unittest.TestCase):
             class TimeControl(GObject):
                 __gproperties__ = {
                     'time': (TYPE_UINT64, 'Time', 'Time',
-                             0L, (1<<64) - 1, 0L,
+                             0, (1<<64) - 1, 0,
                              PARAM_READABLE)
                     }
-        except OverflowError, ex:
+        except OverflowError:
+            exc_class, ex, tb = sys.exc_info()
             self.fail(str(ex))
 
     def testRange(self):
@@ -125,7 +131,7 @@ class TestProperties(unittest.TestCase):
 
         def build_gproperties(types):
             d = {}
-            for key, (gtype, min, max) in types.items():
+            for key, (gtype, min, max) in list(types.items()):
                 d[key] = (gtype, 'blurb', 'desc', min, max, 0,
                           PARAM_READABLE | PARAM_WRITABLE)
             return d
@@ -157,7 +163,7 @@ class TestProperties(unittest.TestCase):
         self.assertEqual(RangeCheck.props.uint64.maximum, maxuint64)
 
         obj = RangeCheck()
-        for key, (gtype, min, max) in types.items():
+        for key, (gtype, min, max) in list(types.items()):
             self.assertEqual(obj.get_property(key),
                              getattr(RangeCheck.props, key).default_value)
 
@@ -202,9 +208,10 @@ class TestProperty(unittest.TestCase):
         o.float = 3.14
         self.assertEqual(o.float, 3.14)
 
-        self.assertEqual(o.long, 0L)
-        o.long = 100L
-        self.assertEqual(o.long, 100L)
+        o.int = 0
+        self.assertEqual(o.int, 0)
+        o.int = 100
+        self.assertEqual(o.int, 100)
 
     def testCustomGetter(self):
         class C(gobject.GObject):
diff --git a/tests/test_signal.py b/tests/test_signal.py
index 96e0731..125c48d 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -4,6 +4,9 @@ import gc
 import unittest
 import sys
 
+if sys.version_info[0] > 2:
+    long = int
+
 from common import gobject, testhelper
 
 class C(gobject.GObject):
@@ -302,7 +305,7 @@ class SigPropClass(gobject.GObject):
         if pspec.name == 'foo':
             self._foo = value
         else:
-            raise AttributeError, 'unknown property %s' % pspec.name
+            raise AttributeError('unknown property %s' % pspec.name)
         try:
             self.emit("my-signal", 1)
         except TypeError:
@@ -349,7 +352,7 @@ class _TestCMarshaller:
         self.assertEqual(rv, 20)
 
     def testTest4(self):
-        self.obj.emit("test4", True, 10L, 3.14, 1.78, 20, 30L, 31L)
+        self.obj.emit("test4", True, 10, 3.14, 1.78, 20, 30, 31)
 
     def testTestReturnFloat(self):
         rv = self.obj.emit("test-float", 1.234)
@@ -371,9 +374,7 @@ if 'generic-c-marshaller' in gobject.features:
     class TestCMarshaller(_TestCMarshaller, unittest.TestCase):
         pass
 else:
-    print
-    print '** WARNING: LIBFFI disabled, not testing'
-    print
+    sys.stdout.write("\n** WARNING: LIBFFI disabled, not testing\n\n")
 
 # Test for 374653
 class TestPyGValue(unittest.TestCase):
diff --git a/tests/test_source.py b/tests/test_source.py
index abe2f69..e32ce1e 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -91,9 +91,9 @@ class TestSource(unittest.TestCase):
 
 
 class TestTimeout(unittest.TestCase):
-     def test504337(self):
-	timeout_source = glib.Timeout(20)
-	idle_source = glib.Idle()
+    def test504337(self):
+        timeout_source = glib.Timeout(20)
+        idle_source = glib.Idle()
 
 
 if __name__ == '__main__':
diff --git a/tests/testhelpermodule.c b/tests/testhelpermodule.c
index d78cf55..d165c99 100644
--- a/tests/testhelpermodule.c
+++ b/tests/testhelpermodule.c
@@ -1,5 +1,15 @@
+
+#include <Python.h>
+#include "pyglib.h"
+#include "pyglib-python-compat.h"
+
 #include "pygobject.h"
-#include <gobject/gmarshal.h>
+
+#include <glib.h>
+
+#include <string.h>
+#include <glib-object.h>
+#include <glib/gthread.h>
 
 #include "test-thread.h"
 #include "test-unknown.h"
@@ -82,7 +92,7 @@ _wrap_test_g_object_new (PyObject * self)
     PyObject *rv;
 
     obj = g_object_new(g_type_from_name("PyGObject"), NULL);
-    rv = PyInt_FromLong(obj->ref_count); /* should be == 2 at this point */
+    rv = _PyLong_FromLong(obj->ref_count); /* should be == 2 at this point */
     g_object_unref(obj);
     return rv;
 }
@@ -112,8 +122,7 @@ static const PyMethodDef _PyTestInterface_methods[] = {
 
 /* TestInterface */
 PyTypeObject PyTestInterface_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,					/* ob_size */
+    PyVarObject_HEAD_INIT(NULL, 0)
     "test.Interface",			/* tp_name */
     sizeof(PyObject),	        /* tp_basicsize */
     0,					/* tp_itemsize */
@@ -122,7 +131,11 @@ PyTypeObject PyTestInterface_Type = {
     (printfunc)0,			/* tp_print */
     (getattrfunc)0,	/* tp_getattr */
     (setattrfunc)0,	/* tp_setattr */
+#if PY_VERSION_HEX < 0x03000000
     (cmpfunc)0,		/* tp_compare */
+#else
+    NULL,
+#endif
     (reprfunc)0,		/* tp_repr */
     (PyNumberMethods*)0,     /* tp_as_number */
     (PySequenceMethods*)0, /* tp_as_sequence */
@@ -183,8 +196,7 @@ _wrap_TestInterface__do_iface_method(PyObject *cls, PyObject *args, PyObject *kw
 }
 
 PyTypeObject PyTestUnknown_Type = {
-    PyObject_HEAD_INIT(NULL)
-    0,                                 /* ob_size */
+    PyVarObject_HEAD_INIT(NULL, 0)
     "testhelper.Unknown",            /* tp_name */
     sizeof(PyGObject),          /* tp_basicsize */
     0,                                 /* tp_itemsize */
@@ -193,7 +205,11 @@ PyTypeObject PyTestUnknown_Type = {
     (printfunc)0,                      /* tp_print */
     (getattrfunc)0,       /* tp_getattr */
     (setattrfunc)0,       /* tp_setattr */
+#if PY_VERSION_HEX < 0x03000000
     (cmpfunc)0,           /* tp_compare */
+#else
+    NULL,
+#endif
     (reprfunc)0,             /* tp_repr */
     (PyNumberMethods*)0,     /* tp_as_number */
     (PySequenceMethods*)0, /* tp_as_sequence */
@@ -311,9 +327,6 @@ static const GInterfaceInfo __TestInterface__iinfo = {
     NULL
 };
 
-#include <string.h>
-#include <glib-object.h>
-
 static void
 test1_callback (GObject *object, char *data)
 {
@@ -524,20 +537,16 @@ static PyMethodDef testhelper_functions[] = {
     { NULL, NULL }
 };
 
-void 
-inittesthelper ()
-{
+PYGLIB_MODULE_START(testhelper, "testhelper")
   PyObject *m, *d;
-  PyObject *module;
   
   g_thread_init(NULL);
-  init_pygobject();
-  m = Py_InitModule ("testhelper", testhelper_functions);
+  pygobject_init(2, 15, 2);
 
-  d = PyModule_GetDict(m);
+  d = PyModule_GetDict(module);
 
-  if ((module = PyImport_ImportModule("gobject")) != NULL) {
-    PyObject *moddict = PyModule_GetDict(module);
+  if ((m = PyImport_ImportModule("gobject")) != NULL) {
+    PyObject *moddict = PyModule_GetDict(m);
     
     _PyGObject_Type = (PyTypeObject *)PyDict_GetItemString(moddict, "GObject");
     if (_PyGObject_Type == NULL) {
@@ -566,5 +575,5 @@ inittesthelper ()
   pyg_set_object_has_new_constructor(TEST_TYPE_UNKNOWN);
   //pyg_register_class_init(TEST_TYPE_UNKNOWN, __GtkUIManager_class_init);
 
-}
 
+PYGLIB_MODULE_END
