summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am1
-rw-r--r--tests/test_gdbus.py6
-rw-r--r--tests/test_properties.py38
3 files changed, 24 insertions, 21 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fea18390..0a0a4462 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -96,6 +96,7 @@ EXTRA_DIST = \
test-floating.h \
test-thread.h \
test-unknown.h \
+ te_ST@nouppera \
org.gnome.test.gschema.xml
EXTRA_DIST += $(TEST_FILES_STATIC) $(TEST_FILES_GI)
diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py
index 19fd76dc..b5a8493d 100644
--- a/tests/test_gdbus.py
+++ b/tests/test_gdbus.py
@@ -62,8 +62,10 @@ class TestGDBusClient(unittest.TestCase):
def test_native_calls_async(self):
def call_done(obj, result, user_data):
- user_data['result'] = obj.call_finish(result)
- user_data['main_loop'].quit()
+ try:
+ user_data['result'] = obj.call_finish(result)
+ finally:
+ user_data['main_loop'].quit()
main_loop = gobject.MainLoop()
data = {'main_loop': main_loop}
diff --git a/tests/test_properties.py b/tests/test_properties.py
index 74c1b384..39306710 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -14,7 +14,7 @@ from gobject.constants import \
G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
G_MAXULONG
-import gio
+from gi.repository import Gio
if sys.version_info < (3, 0):
TEST_UTF8 = "\xe2\x99\xa5"
@@ -37,7 +37,7 @@ class PropertyObject(GObject):
type=TYPE_UINT64, flags=PARAM_READWRITE|PARAM_CONSTRUCT)
enum = gobject.property(
- type=gio.SocketType, default=gio.SOCKET_TYPE_STREAM)
+ type=Gio.SocketType, default=Gio.SocketType.STREAM)
class TestProperties(unittest.TestCase):
def testGetSet(self):
@@ -135,30 +135,30 @@ class TestProperties(unittest.TestCase):
def testEnum(self):
obj = new(PropertyObject)
- self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
- self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
- obj.enum = gio.SOCKET_TYPE_DATAGRAM
- self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_DATAGRAM)
- self.assertEqual(obj.enum, gio.SOCKET_TYPE_DATAGRAM)
- obj.props.enum = gio.SOCKET_TYPE_STREAM
- self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
- self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
+ self.assertEqual(obj.props.enum, Gio.SocketType.STREAM)
+ self.assertEqual(obj.enum, Gio.SocketType.STREAM)
+ obj.enum = Gio.SocketType.DATAGRAM
+ self.assertEqual(obj.props.enum, Gio.SocketType.DATAGRAM)
+ self.assertEqual(obj.enum, Gio.SocketType.DATAGRAM)
+ obj.props.enum = Gio.SocketType.STREAM
+ self.assertEqual(obj.props.enum, Gio.SocketType.STREAM)
+ self.assertEqual(obj.enum, Gio.SocketType.STREAM)
obj.props.enum = 2
- self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_DATAGRAM)
- self.assertEqual(obj.enum, gio.SOCKET_TYPE_DATAGRAM)
+ self.assertEqual(obj.props.enum, Gio.SocketType.DATAGRAM)
+ self.assertEqual(obj.enum, Gio.SocketType.DATAGRAM)
obj.enum = 1
- self.assertEqual(obj.props.enum, gio.SOCKET_TYPE_STREAM)
- self.assertEqual(obj.enum, gio.SOCKET_TYPE_STREAM)
+ self.assertEqual(obj.props.enum, Gio.SocketType.STREAM)
+ self.assertEqual(obj.enum, Gio.SocketType.STREAM)
self.assertRaises(TypeError, setattr, obj, 'enum', 'foo')
self.assertRaises(TypeError, setattr, obj, 'enum', object())
- self.assertRaises(TypeError, gobject.property, type=gio.SocketType)
- self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
- default=gio.SOCKET_PROTOCOL_TCP)
- self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
+ self.assertRaises(TypeError, gobject.property, type=Gio.SocketType)
+ self.assertRaises(TypeError, gobject.property, type=Gio.SocketType,
+ default=Gio.SocketProtocol.TCP)
+ self.assertRaises(TypeError, gobject.property, type=Gio.SocketType,
default=object())
- self.assertRaises(TypeError, gobject.property, type=gio.SocketType,
+ self.assertRaises(TypeError, gobject.property, type=Gio.SocketType,
default=1)
def testRange(self):