1
0
mirror of https://github.com/django/django.git synced 2025-03-05 15:02:31 +00:00

Skipped PostGIS version tests when psycopg2 not installed

Refs #22334. Thanks Tim Graham for spotting the issue.
This commit is contained in:
Claude Paroz 2014-03-29 19:24:14 +01:00
parent 88f1e3d93d
commit e819a3cd62

View File

@ -1,10 +1,16 @@
import unittest import unittest
from django.contrib.gis.db.backends.postgis.operations import PostGISOperations
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.db import ProgrammingError from django.db import ProgrammingError
try:
from django.contrib.gis.db.backends.postgis.operations import PostGISOperations
HAS_POSTGRES = True
except ImportError:
HAS_POSTGRES = False
if HAS_POSTGRES:
class FakeConnection(object): class FakeConnection(object):
def __init__(self): def __init__(self):
self.settings_dict = { self.settings_dict = {
@ -27,6 +33,7 @@ class FakePostGISOperations(PostGISOperations):
raise NotImplementedError('This function was not expected to be called') raise NotImplementedError('This function was not expected to be called')
@unittest.skipUnless(HAS_POSTGRES, "The psycopg2 driver is needed for these tests")
class TestPostgisVersionCheck(unittest.TestCase): class TestPostgisVersionCheck(unittest.TestCase):
""" """
Tests that the postgis version check parses correctly the version numbers Tests that the postgis version check parses correctly the version numbers