Commit c2652896 authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Fix tests with psycopg2 >= 2.8

Since 2.8, psycopg2 errors have been extended to support all postgresql
specifics errors:

Keep backward compatibility of tests with psycopg2<2.8 since we may want to run tests (e.g. debian packages) with older psycopg2.
parent f9d9de9ae834
......@@ -41,7 +41,9 @@ class PostgisTC(testlib.CubicWebTC):
# wrong srid
with self.assertRaises(Exception) as ctx:
cnx.create_entity('City', name=u'Nantes', center_4326=(u'POINT(1.5 47.25)', -1))
self.assertEqual(ctx.exception.__class__.__name__, 'DataError')
# psycopg2 < 2.8 raises DataError
# psycopg2 >= 2.8 raises InvalidParameterValue
self.assertIn(ctx.exception.__class__.__name__, ('DataError', 'InvalidParameterValue'))
def test_geometry_nosrid(self):
with self.admin_access.repo_cnx() as cnx:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment