From 5a025825cc4843e7f57f97db50c471a881380f9f Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo <daniele.varrazzo@gmail.com> Date: Wed, 24 Nov 2010 11:04:18 +0000 Subject: [PATCH] Skip test if uuid not available on Python. --- tests/types_extras.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/types_extras.py b/tests/types_extras.py index f733950b..61d2857e 100644 --- a/tests/types_extras.py +++ b/tests/types_extras.py @@ -29,6 +29,11 @@ import tests def skip_if_no_uuid(f): def skip_if_no_uuid_(self): + try: + import uuid + except ImportError: + return self.skipTest("uuid not available in this Python version") + try: cur = self.conn.cursor() cur.execute("select typname from pg_type where typname = 'uuid'") @@ -39,7 +44,7 @@ def skip_if_no_uuid(f): if has: return f(self) else: - return self.skipTest("uuid type not available") + return self.skipTest("uuid type not available on the server") return skip_if_no_uuid_