summaryrefslogtreecommitdiff
path: root/test/test-client.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2011-12-13 11:55:44 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-12-13 11:55:44 +0000
commit14225c74b5bd75cf6c4cda3647341dc20214e6b8 (patch)
tree681f90d0f96ac02d393a74f9312de33d1c6f7cb3 /test/test-client.py
parent959ce518a3b5b8794b9813bac82c64540c21fc31 (diff)
downloaddbus-python-14225c74b5bd75cf6c4cda3647341dc20214e6b8.tar.gz
Use Python 3 syntax to catch exceptions
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'test/test-client.py')
-rwxr-xr-xtest/test-client.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/test-client.py b/test/test-client.py
index 753d892..e0e639c 100755
--- a/test/test-client.py
+++ b/test/test-client.py
@@ -199,7 +199,7 @@ class TestDBusBindings(unittest.TestCase):
elif not self.utf8 and isinstance(val, dbus.UTF8String):
failures.append('%r should not have been utf8' % val)
return
- except Exception, e:
+ except Exception as e:
failures.append("%s:\n%s" % (e.__class__, e))
def error_handler(self, error):
@@ -371,7 +371,7 @@ class TestDBusBindings(unittest.TestCase):
try:
print "requesting %s" % name
busname = dbus.service.BusName(name, dbus.SessionBus())
- except Exception, e:
+ except Exception as e:
print "%s:\n%s" % (e.__class__, e)
self.assert_(not succeed, 'did not expect registering bus name %s to fail' % name)
else:
@@ -462,7 +462,7 @@ class TestDBusBindings(unittest.TestCase):
self.assertRaises(dbus.DBusException, self.iface.AsyncRaise)
try:
self.iface.AsyncRaise()
- except dbus.DBusException, e:
+ except dbus.DBusException as e:
self.assert_(e.get_dbus_name() ==
'org.freedesktop.bugzilla.bug12403',
e.get_dbus_name())
@@ -518,7 +518,7 @@ class TestDBusBindings(unittest.TestCase):
try:
self.iface.RaiseValueError()
- except Exception, e:
+ except Exception as e:
self.assert_(isinstance(e, dbus.DBusException), e.__class__)
self.assert_('.ValueError: Traceback ' in str(e),
'Wanted a traceback but got:\n"""%s"""' % str(e))
@@ -527,7 +527,7 @@ class TestDBusBindings(unittest.TestCase):
try:
self.iface.RaiseDBusExceptionNoTraceback()
- except Exception, e:
+ except Exception as e:
self.assert_(isinstance(e, dbus.DBusException), e.__class__)
self.assertEquals(str(e),
'com.example.Networking.ServerError: '
@@ -537,7 +537,7 @@ class TestDBusBindings(unittest.TestCase):
try:
self.iface.RaiseDBusExceptionWithTraceback()
- except Exception, e:
+ except Exception as e:
self.assert_(isinstance(e, dbus.DBusException), e.__class__)
self.assert_(str(e).startswith('com.example.Misc.RealityFailure: '
'Traceback '),