summaryrefslogtreecommitdiff
path: root/tests/testutils.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-11-20 20:00:35 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2017-11-20 20:00:35 -0800
commit390e43fcb191d1b52ca747e2b71f938f9df52c95 (patch)
treef8c6259410ddf8087fba730faacc906b09878106 /tests/testutils.py
parent7a2dd85caa7553d163f6579eb513a370ef069a0e (diff)
downloadpsycopg2-390e43fcb191d1b52ca747e2b71f938f9df52c95.tar.gz
Use modern except syntax throughout project
The syntax "except Exception, exc:" is deprecated. All Python versions supported by psycopg2 support the newer, modern syntax. Forward compatible with future Python versions.
Diffstat (limited to 'tests/testutils.py')
-rw-r--r--tests/testutils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/testutils.py b/tests/testutils.py
index 7489a98..5c192e3 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -116,7 +116,7 @@ class ConnectingTestCase(unittest.TestCase):
def connect(self, **kwargs):
try:
self._conns
- except AttributeError, e:
+ except AttributeError as e:
raise AttributeError(
"%s (did you forget to call ConnectingTestCase.setUp()?)"
% e)
@@ -149,7 +149,7 @@ class ConnectingTestCase(unittest.TestCase):
conn = self.connect(**kwargs)
if conn.async_ == 1:
self.wait(conn)
- except psycopg2.OperationalError, e:
+ except psycopg2.OperationalError as e:
# If pgcode is not set it is a genuine connection error
# Otherwise we tried to run some bad operation in the connection
# (e.g. bug #482) and we'd rather know that.
@@ -388,7 +388,7 @@ def skip_if_no_superuser(f):
from psycopg2 import ProgrammingError
try:
return f(self)
- except ProgrammingError, e:
+ except ProgrammingError as e:
import psycopg2.errorcodes
if e.pgcode == psycopg2.errorcodes.INSUFFICIENT_PRIVILEGE:
self.skipTest("skipped because not superuser")